WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I used the search but couldn't get the right answer for my issue.

I developped a theme, which on the portfolio template take the selected featured image of the different portfolio items and crop them to a fixed size (add_image_size) to make them fit to the general grid. Until here no Problem ;)

But what if I want to make all custom uploaded images "retina ready". I know there are some scripts (retina.js) which search on the server if there are a bigger/@2x version of the image and take them. But if the image is cropped by the add_image_size (Ex: the_post_thumbnail('custom-thumb'); ) function, the double/bigger image will have no effect on it?

Am I right? How can I solve this issue?

share|improve this question

Sorry I don't have specific code, but this is how I would do it:

Define two upload sizes, one regular and one double sized for retina using 'add_image_size'.

Use the filter 'wp_handle_upload_prefilter' to add the extension '@2x' to only images of the larger size.

Then use retina .js as normal.

This page as some code using that filter to rename uploaded images, you just need to tailor it to only rename specific uploads: http://wordpressapi.com/2012/01/11/change-uploaded-image-name-to-post-slug-during-upload-using-variables/

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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