title: Wordpress select image size as PHP Variable
body: <p>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 <code>300x300</code>, wordpress may crop it to say <code>300x180</code> to keep it in dimension.</p>
  
  <p>This makes it difficult when programatically fetching a larger version of an image thumbnail as the file ending <code>-300x300.jpg</code> may not exist.</p>
  
  <p>Is there a way of fetching the image by using the URL for the full image, with a PHP variable eg. <code>?size=medium</code> 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.</p>