0

In the WP admin I set the "large" image size to 2560 x 1440.

What I have found is that if the image I'm uploading is smaller than these dimensions, the large image doesn't get generated.

I'm using the JSON API and can see that it doesn't provide a value for "large".

So for example I am trying to output the image for each post and on my front end I'm doing:

echo $post->image->sizes('large');

However as the large image doesn't exist for some posts it gives me an error. In this case I want to get the next available image. How do I go about this?

I know I can probably create a function to check for the existence of the large image but I was wondering if there's a better way to do this? For example could it not still generate a large image even though it doesn't fulfil the dimensions? I don't want to use the original image as that can be many MB.

1 Answer 1

0

you can try to suitable with any one of this function for image get the_post_thumbnail() OR get_the_post_thumbnail().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.