WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

There is a type of post on my blog which requires one extremely large image (such that it can be zoomed). I don't want to register a new image size, because I only need a certain small subset of images to have this large image size. I have managed to generate this additional large image and it sits alongside the other three "generated" images in the uploads directory, however since it is not registered with the Media Library, it does not get uploaded to the image CDN with W3 Total Cache.

Can anyone suggest a better approach to my problem? Or suggest how I might register that large image with the media library (without it automatically creating the other image sizes which would not be needed). Or is there perhaps a way to register an additional image size for only some images in my media library?

share|improve this question
how do you get the image? – Mark Kaplun Dec 5 '13 at 10:52
@MarkKaplun I essentially use: image_make_intermediate_size($srcFilePath, $max_desired_width, $max_desired_height, $crop); This generates the large image at the desired dimension from an attachment. Obviously there is additional caching mechanisms such that it's only generated once but that's essentially it. – Willster Dec 5 '13 at 12:10
One solution will be to add a checkbox in the wp uploader, then filter the resize and upload handler to only generate new image sizes for your "checked" uploads, but I don't know how wp will handle the other images with a missing size. – Dan Ștefancu Dec 12 '13 at 19:20
up vote 2 down vote accepted

Since you know the location of the image on the disk you can use wp_insert_attachment to insert your big image to the media library. By default this will generate also several smaller versions of the big image that you might not need but this is the easiest way to make all the media related plugins to be aware to your image.

share|improve this answer
I think your answer is certainly straight forward, but I thought there might be a nicer way. If no one further enlightens me I'll accept this. – Willster Dec 6 '13 at 15:47

Maybe using the featured image for this posttype and then load the full size picture in there?

share|improve this answer
The full size picture is not guaranteed to be at the correct size required unfortunately. This CMS must be fool proof so there is no requirement on the person uploading to have resized the image correctly before hand. – Willster Dec 5 '13 at 10:32

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.