@quark-fw/plugin-uploads 0.1.22 → 0.1.24

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/images.ts +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quark-fw/plugin-uploads",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "type": "module",
@@ -24,14 +24,14 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@quark-fw/plugin": "0.1.22",
27
+ "@quark-fw/plugin": "0.1.24",
28
28
  "@types/busboy": "^1.5.4",
29
29
  "busboy": "^1.6.0",
30
30
  "express": "^5.2.1",
31
31
  "sharp": "^0.34.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@quark-fw/core": "0.1.22"
34
+ "@quark-fw/core": "0.1.24"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/express": "^5.0.6",
package/src/images.ts CHANGED
@@ -83,8 +83,11 @@ export async function processImage(
83
83
  const sharp = await loadSharp();
84
84
  const source = sharp(buffer, { failOn: "none" }).rotate(); // EXIF-поворот → реальная ориентация
85
85
  const meta = await source.metadata();
86
- const width = meta.width ?? 0;
87
- const height = meta.height ?? 0;
86
+ // metadata() даёт размеры до EXIF-поворота, а варианты уже повёрнуты:
87
+ // для ориентаций 5–8 (поворот на 90°) стороны меняются местами
88
+ const rotated = (meta.orientation ?? 1) >= 5;
89
+ const width = (rotated ? meta.height : meta.width) ?? 0;
90
+ const height = (rotated ? meta.width : meta.height) ?? 0;
88
91
  const out: ProcessedVariant[] = [];
89
92
  for (const [name, spec] of Object.entries(variants)) {
90
93
  const format = spec.format ?? "webp";