0

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.

migrated from stackoverflow.com Jul 7 '13 at 14:35

This question came from our site for professional and enthusiast programmers.

0

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 '13 at 12:44

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.