I've specified some custom image sizes each with a non-default crop position (e.g. top-center). However, when I use wp_get_attachment_image and specify size to be one that I defined, I get a correctly sized image with an incorrect crop position.

It turns out that the image URI is of the form https://i1.wp.com/example.com/wp-content/uploads/2017/11/myimage.jpg?resize=293%2C160, even though I definitely have the proper https://example.com/wp-content/uploads/2017/11/myimage-293x160.jpg image with correct crop position. Interestingly, though, wp_get_attachment_metadata returns the correct, static URI for the given image size.

Why is WordPress deferring to dynamic resizing? Is this somehow prefereble? In any case, how can I disable it?

  • 3
    Are you on a wp.com site? Or have Jetpack photon turned on? Standard WP doesn't generate images on the fly via URL, the images are just served straight off of the file system – Tom J Nowell Nov 2 '17 at 0:47
  • 1
    Turns out that Jetpack came preinstalled, and with Photon enabled. One flick of a toggle switch and my problem is solved. Thanks much! Turn your comment into a question for reputation if you so please. – Joel Christophel Nov 2 '17 at 0:54
  • 1
    Into an *answer haha – Joel Christophel Nov 2 '17 at 1:07
  • Great answer Tom J Nowell: In my case I had to switch off the option "Speed up your site > Serve images from our servers" in the JetPack settings – bgx Jun 5 '18 at 9:52

Please try this plugin for regenerate image thumbnail and then try to display it.Thumnail regenerate plugin

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.