Wordpress creates a new image URL for each of the sizes of images it creates when an image is uploaded. It adds the image size in pixels to the end of the string before the image extension. The problem is that if say an image size for a medium image is 300x300
, wordpress may crop it to say 300x180
to keep it in dimension.
This makes it difficult when programatically fetching a larger version of an image thumbnail as the file ending -300x300.jpg
may not exist.
Is there a way of fetching the image by using the URL for the full image, with a PHP variable eg. ?size=medium
on the end that will load the correct version. I'm sure I have done this with older versions of wordpress but cannot find any documentation to prove this.