mirror of
https://github.com/thelounge/thelounge
synced 2024-11-22 20:13:07 +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"
|
type="checkbox"
|
||||||
name="removeImageMetadata"
|
name="removeImageMetadata"
|
||||||
/>
|
/>
|
||||||
Attempt to remove metadata from images before uploading
|
Remove metadata from uploaded images
|
||||||
<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>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -251,8 +251,12 @@ class Uploader {
|
||||||
chunks.push(chunk);
|
chunks.push(chunk);
|
||||||
})
|
})
|
||||||
.on("end", () => {
|
.on("end", () => {
|
||||||
const buffer = Buffer.concat(chunks);
|
sharp(Buffer.concat(chunks), {
|
||||||
sharp(buffer, {animated: true, pages: -1, sequentialRead: true})
|
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
|
.toFile(destPath) // Removes metadata by default https://sharp.pixelplumbing.com/api-output#tofile
|
||||||
.catch(abortWithError);
|
.catch(abortWithError);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue