mirror of
https://github.com/thelounge/thelounge
synced 2024-11-14 00:07:17 +00:00
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
2 changed files with 7 additions and 9 deletions
|
@ -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 a new issue