Image(s) in different sizes from API

Hello, Ghost’s,

From the API documentation, it seems we can only retrieve one image size(original?) from the API, e.g. from “/content/posts/{id}/” we get the attribute “feature_image”.

But is there a way we can get the resized version of the image for different displays etc.?

Best wishes,
Mikkel Lindhard

One option would be to reconstruct the resized URL based on the feature_image.

For example, if you’re returned https://yoursite.com/content/images/2023/02/image.jpg and you know the sizes set by the theme, then you can safely reconstruct the resized image URL. For example, this is for AVIF:

https://yoursite.com/content/images/size/w800/format/avif/2023/02/image.jpg

You just need to substitute the desired width (w800) and format. Format can be omitted for the resized image in the original format.