Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotation of uploaded images #5996

Closed
alxnkt opened this issue Apr 28, 2020 · 3 comments · Fixed by #6768
Closed

Rotation of uploaded images #5996

alxnkt opened this issue Apr 28, 2020 · 3 comments · Fixed by #6768
Labels
issue: feature request Issue suggesting a new feature severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve

Comments

@alxnkt
Copy link
Contributor

alxnkt commented Apr 28, 2020

Describe the bug (feature)
In Strapi of version beta.20 there is a new possibility - creation of thumbnails of images. This is very useful and convenient feature. Thank you. In previous versions I had to do it by my own with help of sharp package: I could resize and rotate an image according to EXIF orientation tag.
New upload plugin does not automatically rotate images, so photos from iphone with "portrait" orientation (orientation tag 6) appears with wrong rotation.
So I want to ask:

  1. Is there any way to "hook" upload process to rotate an image (or do some other manipulations)?
  2. Is there any way to choose necessary formats? For example, I need thumbnail and medium size, but I don't need large size, sometimes I don't even need original file.

Steps to reproduce the behavior

  1. Upload any image with EXIF orientation tag equaled 6 (photo from iphone with "portrait" orientation).
  2. Go to "Media Library".
  3. Ensure the image has improper rotation.

Expected behavior
I would like images to be properly rotated.

Screenshots
In Finder:
finder
In Media Library (the building "fell down"):
media

Code snippets
My implementation of auto rotation:

// sharp automatically rotates image according to orientation tag
const thumbnailBuffer = await sharp(file.path)
    .resize(300)
    .rotate()
    .toBuffer();

System

  • Node.js version: 13.13.0
  • NPM version: 6.14.4
  • Strapi version: 3.0.0-beta.20.1
  • Database: PostgreSQL 12.2
  • Operating system: MacOS Catalina 10.15.4
@lauriejim lauriejim added severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve issue: feature request Issue suggesting a new feature labels May 7, 2020
@lauriejim
Copy link
Contributor

Thank you for this message!
I ping @Aurelsicoko @soupette and @alexandrebodin for this idea.

@alxnkt
Copy link
Contributor Author

alxnkt commented Jul 24, 2020

Seems like issue can be closed, because PR is merged.

@derrickmehaffy
Copy link
Member

This issue has been mentioned on Strapi Community Forum. There might be relevant details there:

https://forum.strapi.io/t/image-upload-rotating-exif-param/3538/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: feature request Issue suggesting a new feature severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants