1

I uploaded an image my-image.jpg of dimension 1280x854, after that, I went to Dashboard > Media to crop it to 854x854. (Apply changes to All Image Sizes.)

This however only change its thumbnail in Media Library, when I click the thumbnail, the popup window shows still the original image, before cropped.

In the Uploads folder, I have verified that the cropped image files are existing, with name like my-image-e15249112352.jpg, my-image-e15249112352-854x617.jpg, etc.

I tried to get the image by its id:

wp_get_attachment_image_src(3629, 'large');

The expected return is the cropped image, but the actual return is the original image, like I never cropped the image.

1 Answer 1

0

Try like this : REF: https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/

wp_get_attachment_image_src(3629, array( 854, 854 ));

Hope is useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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