@dnax/core 0.9.6 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/hono.ts +4 -1
- package/lib/schema.ts +1 -1
- package/package.json +1 -1
- package/types/index.ts +1 -0
package/app/hono.ts
CHANGED
|
@@ -564,6 +564,7 @@ function HonoInstance(): typeof app {
|
|
|
564
564
|
const width = parseInt(c.req.query("w")) || null;
|
|
565
565
|
const height = parseInt(c.req.query("h")) || null;
|
|
566
566
|
const quality = parseInt(c.req.query("q")) || 80;
|
|
567
|
+
const crop = c.req.query("fit") || "contain";
|
|
567
568
|
// Vérifier si le fichier existe
|
|
568
569
|
if (!fs.existsSync(filePath)) {
|
|
569
570
|
return c.text("file not found", 404);
|
|
@@ -583,7 +584,9 @@ function HonoInstance(): typeof app {
|
|
|
583
584
|
try {
|
|
584
585
|
// Redimensionner l'image avec Sharp
|
|
585
586
|
const buffer = await sharp(filePath)
|
|
586
|
-
.resize(width, height
|
|
587
|
+
.resize(width, height, {
|
|
588
|
+
fit: crop || "contain",
|
|
589
|
+
})
|
|
587
590
|
.jpeg({ quality })
|
|
588
591
|
.toBuffer();
|
|
589
592
|
|
package/lib/schema.ts
CHANGED
package/package.json
CHANGED