Image API inconsistency

The documentation here https://www.contentful.com/developers/docs/references/images-api/#/introduction says that when you get an image from the asset api you get a url like
//images.ctfassets.net/yadj1kx9rmg0/... which matches the API base url https://images.ctfassets.net

But when I connect to the API to fetch an asset, it comes back as //downloads.ctfassets.net/f24ml…

I was trying to do image manipulation and couldn’t figure out why it wasn’t working until I noticed the URL difference: image manipulation doesn’t work on ‘downloads’. Is there a reason for this discrepancy? I can of course replace ‘downloads’ with ‘images’ in the URL but this is obviously not ideal because if you ever change the url in the future this can break.

2 Likes

I have encountered the same issue with one image, while other images just work fine.

I couldn’t find any information if this happens for some specific reason. My only guess would be, this happens with very large images, as the one where this occurs for me happens to be larger than all others in the project.

Nevertheless, replacing “downloads.” with “images.” works as expected. Of course though, this is not a particularly nice solution.

I would be very glad if somebody from the Contentful team could have a look into this :slight_smile:

From Contentful:

As per the Technical Limits specifications, the size of an image uploaded must not exceed 20MB. Images exceeding the size limit are treated as assets and the transformation features offered by the API are not applicable. For the same reason, the image in question has the domain downloads.cfassets.net , instead of images.ctassets.net .

To prevent this from happening again in the future, you may want to put in a restriction on file size.

1 Like