I have the URL of an image (full size). During the upload it already generates a smaller version (I added this in functions). How can I get this cropped version when I have the full size URL?

The Image is not in a post so I can't use post-thumbanil(). The image is in a slider on the Homepage.

1 Answer 1


if you have the attachment (image) id, you ca use :

 wp_get_attachment_image_src( $attachment_id, $size);

where $size is the smaller version you want. (see http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src)

If you don't know the attachment id you may query the database for full image size url : http://pippinsplugins.com/retrieve-attachment-id-from-image-url/

  • Thank you. Exactly something I was looking for. This helped me a lot.
    – Nepo Znat
    Jul 7, 2013 at 12:44

Your Answer

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

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