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

Optimize image loading #587

Open
RGBboy opened this issue Jul 6, 2018 · 3 comments
Open

Optimize image loading #587

RGBboy opened this issue Jul 6, 2018 · 3 comments
Assignees

Comments

@RGBboy
Copy link
Contributor

RGBboy commented Jul 6, 2018

Contentful has an API to crop and resize images. Currently we just load the original image regardless of size. To help with the Android out of memory issue and decrease the bandwidth consumption of the app we should load the appropriate sized image for where we are displaying it. As an example Cabaret_finalists.jpg?w=500&h=500&fit=fill.

This image originally returns the following data:

{
  id: "4iXietXWjecIke4K4m8mii"
  revision: 1
  uri: "https://images.ctfassets.net/n2o4hgsv6wcx/4iXietXWjecIke4K4m8mii/f51a9ba4d860859cc3286d23cc29c0e7/Cabaret_finalists.jpg"
  width: 1500
  height: 1000
}

We would need to figure out the size of image to request. Perhaps by using React Natives onLayout handler (although not using this API would be preferred).

@robbiemccorkell
Copy link
Contributor

😱 I had no idea this was available

@Lily418
Copy link

Lily418 commented Jul 6, 2018

Currently having a look and I haven't yet spotted how this works with Contentful Sync API which is implemented at the moment, this may be only an option when using the Asset api directly.

@Lily418
Copy link

Lily418 commented Jul 6, 2018

Apologies, I'd misunderstood that the Sync API doesn't sync the image data just the url of the images so was looking in the wrong place.

Lily418 pushed a commit that referenced this issue Jul 19, 2018
…g-resize

Optimize Contentful image loading
markholland referenced this issue Nov 19, 2018
…mage-loading-resize

Revert "Optimize Contentful image loading"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants