Auto rotate images based on exif orientation
This makes sure that the orientation of the images work in all viewrs.
This commit is contained in:
parent
846da41b01
commit
c2c66031c0
@ -246,13 +246,7 @@
|
||||
type="checkbox"
|
||||
name="removeImageMetadata"
|
||||
/>
|
||||
Attempt to remove metadata from images before uploading
|
||||
<span
|
||||
class="tooltipped tooltipped-n tooltipped-no-delay"
|
||||
aria-label="This option will removes metadata from images and animated wepb files. This may break the images orientation."
|
||||
>
|
||||
<button class="extra-help" />
|
||||
</span>
|
||||
Remove metadata from uploaded images
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -251,8 +251,12 @@ class Uploader {
|
||||
chunks.push(chunk);
|
||||
})
|
||||
.on("end", () => {
|
||||
const buffer = Buffer.concat(chunks);
|
||||
sharp(buffer, {animated: true, pages: -1, sequentialRead: true})
|
||||
sharp(Buffer.concat(chunks), {
|
||||
animated: true,
|
||||
pages: -1,
|
||||
sequentialRead: true,
|
||||
})
|
||||
.rotate() // auto-orient based on the EXIF Orientation tag
|
||||
.toFile(destPath) // Removes metadata by default https://sharp.pixelplumbing.com/api-output#tofile
|
||||
.catch(abortWithError);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user