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

Thumbnail generation has wrong orientation #726

Closed
alxvallejo opened this issue May 27, 2020 · 4 comments
Closed

Thumbnail generation has wrong orientation #726

alxvallejo opened this issue May 27, 2020 · 4 comments

Comments

@alxvallejo
Copy link

I'm not sure why the example isn't using sharp() since so many other example recommend using the library for image manipulation, but no image orientation fixes (rotate, crop) are being used in the sample. Can anyone explain why?

https://github.com/firebase/functions-samples/tree/master/generate-thumbnail

@jhuleatt
Copy link
Collaborator

Hi @alxvallejo, that's meant to be a really minimal sample that uses the image manipulation tool built in to Cloud Functions for Firebase (ImageMagick).

We have a sharp sample here: https://github.com/firebase/functions-samples/tree/master/image-sharp

If you'd like to see a more productionized version that does account for rotation, you can take a look at the source for the storage-resize-images extension: https://github.com/firebase/extensions/blob/d79a44522d1a889ce33ae5902eb6c1eeb28f87f0/storage-resize-images/functions/src/index.ts#L155-L158

@alxvallejo
Copy link
Author

The sharp sample is outdated. The max() method has been deprecated.

What would really be helpful is to combine both simple approaches:

  • Use sharp for thumbnail generation
  • Use admin SDK to save the new path to the RTDB

Right now, i'm unsure of how to do that given the example, since sharp seems to rely on streams with a promise that doesn't return the images for saving.

@billymahmood
Copy link

Hi @alxvallejo

Did you find a solution to this issue?

Thank you

@alxvallejo
Copy link
Author

@billymahmood Yes, actually made a PR, but haven't had time to format it -> #730

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants