Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a theme installed which automatically generates differnet sizes of images (thumbnails) when I add a "featured" image in a post.

supermuc-106x80.jpg supermuc-116x80.jpg supermuc-150x100.jpg supermuc-150x150.jpg supermuc-290x180.jpg supermuc-300x174.jpg supermuc-600x250.jpg supermuc-600x400.jpg supermuc-905x500.jpg supermuc.jpg

Thats OK so far. My problem is when I want to add some more pictures/photos inside the post it also creates differnet sizes of the picture but actually this is not "featured" image so all those sizes are just wasting my disk space.

Is there any way or plugin to allow me select which thumbnails will be generated when I upload an image? So I can "disable" all sizes I dont want to be created and save disk space?

share|improve this question
    
Why are you worried about disk space? Storage space is incredibly cheap and abundant, and small jpegs and pngs are a trivial size, you could fit billions of such files on your HD, nevermind unlimited hosting plans –  Tom J Nowell Aug 26 '12 at 17:50
    
Also what do you mean by the 'featured' image. When I set a featured image, it's uploaded as an attachment and then a version of that image is displayed according to the theme settings, usually the thumbnail size. –  Tom J Nowell Aug 26 '12 at 17:52

3 Answers 3

up vote 0 down vote accepted

Check out @Otto's plugin Dynamic Image Resizer. I think it does exactly what you're asking for.

I haven't used it before, so I can't vouch for it, but the plugin author's identity goes a long way toward me trusting it.

share|improve this answer
    
that really helped me after all. thanks –  GeorgeK Aug 30 '12 at 13:45

The plugin

As an alternative to @mrwweb answer, I can recommend my plugin »Dynamic Image Resize«, which is not hosted in the official repository - Disclaimer: it's free and it's not a fork of ottos plugin.

How it works:

There's a Shortcode to make things easy:

Place [dynamic_image] in your content. The shortcode has four arguments:

  • src Full path to the image in your upload directory or the ID
  • width Integer value
  • height Integer value
  • classes Css classes – separated by a space

There's also a template tag, that you can use in your theme.

// The args need to be an array
dynamic_image_resize( array(
     // The full path to the image in your uploads folder
     'src'     => 'http://example.com/wp-content/uploads/2012/03/some_image.png'
     // OR: the ID
     'src'     => 6

    ,'width'   => 60
    ,'height'  => 100
    ,'classes' => 'some classes to align and style the image'
) );

Disable default sizes

Simply go to

Admin UI/backend » Settings » Media

then add 0 as height/width for sizes that you don't need. This disables the generation of this size.

share|improve this answer
    
Ok that is a very interesting plugin but my original question is how to upload the file without creating several size-versions of the image? If I upload the image it would already have a resized version so why do I need to use dynamic image resize? First, you have to help me how to upload an image without the extra size-versions being automatically generated. –  GeorgeK Aug 27 '12 at 0:46
    
@GeorgeK Disable default sizes: See edit. About dynamic sizes: More freedom and no additional sizes, that you don't need. –  kaiser Aug 27 '12 at 1:54
    
What about performance? The server always creates the size on fly and if you have many requests it will "eat" the cpu. And as far as I know CPU in hosting is more expensive than HDD. Am I wrong? –  GeorgeK Aug 27 '12 at 8:50
    
No, that happens only the first time/for the first visitor with this request. Then Image is then saves with the suffix resized-X-Y and $needs_resize won't get set to true, so bypasses this step. Later users will have an equally fast experience as with other pages. No draw backs with this solution :) –  kaiser Aug 27 '12 at 10:49
    
Oh, so your plugin actually creates image sizes when needed and IF needed. Right? –  GeorgeK Aug 27 '12 at 11:22

If your theme is using WordPress Feature Image then you should check functions.php there you could find something similar to the code below

add_image_size( 'homepage-thumb', 220, 180, true ); 

The term homepage-thumb could be different. You can remove/comment out the code which calls for different image sizes that you think are not required.

share|improve this answer

Your Answer

 
discard

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.