I am trying to make it so that WP will create another size image for me, but only when the image is uploaded via the Thickbox, and only when it will be attached to a certain ID.

Does anybody know how to do this?

The following works, but will create an image of that size for every upload, which is just inefficient.

add_action('after_setup_theme', 'set_image_upload_size');
function set_image_upload_size(){

    if(!{is Thickbox upload} || !{is attached to page 6838}) : // Don't know how to check this...
        return false;

    /** Add an upload size for the footer images */
    add_image_size('footer-logo', 60, 40, false);


2 Answers 2


There is no solution for this as of WP 3.5. There are a couple of core tickets about introducing the ability defer the generation of specific images sizes on the fly rather than at upload time to prevent the generation of multiple images that will never be used. However, they are far from being included in core at this point. See http://core.trac.wordpress.org/ticket/15311 and http://core.trac.wordpress.org/ticket/22100.

  • 1
    Well that's a real shame, looks like a fair few other people think it would be a good idea. Thanks for your reply.
    – David Gard
    Commented Dec 20, 2012 at 16:45

Have a look at this proposed solution. It's an on the fly resizing function.

It's actually taken from the ticket prettyboymp posted in the previous answer.

  • Thanks, I'll have a look, but I think I didn't go for it initially as it's probably a little overkill for what I need.
    – David Gard
    Commented Mar 1, 2013 at 21:22

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.