AFAIK, WordPress only generates Thumbnails (e.g., ‘large’) only when the desired image size is smaller (and not when the target size would be the same).
I use
add_image_size( 'referenzen-big', 627, 490, true );
So if my customer uploads a file with 627x490px, the original Image will be used.
But this is not desired, since this customed, in all good faith, uploads the images in the right size, and also highest possible .jpg-compression. This results in images being around 300kB in this case.
A pratical, but technicall not flawless way would be to ask him to upload his images in 628×490, so 1px more width, forcing a rescale. Suggestions like this will not be accepted 🙂
So far, I’ve investigated the hooks responsible for image creation, and tracked the responsible function down; here’s the last hook I found:
image_make_intermediate_size()
this is the function responsible for the actual resizing:
image_resize_dimensions().
There’s even a line saying:
// if the resulting image would be the same size or larger we don't want to resize it
if ( $new_w >= $orig_w && $new_h >= $orig_h )
return false;
So how can I enable this “force resize” feature?
Here is the solution you are looking for, to be placed in your functions.php file:
This is found here:
https://wordpress.stackexchange.com/questions/50649/how-to-scale-up-featured-post-thumbnail
It will upscale images and generate thumbnails for all image sizes. The only downfall, which probably isn’t a downfall, is that no matter what you’ll get a separate file for each image size for all uploaded images… even if it’s a small icon or something. Hope this helps.
While still not optimal, wouldn’t it be better to use a serverside library like Timthumb and then provide the original source and use the ‘q’ (= quality) parameter?
That would optimize the image, with the original size.
Might be some caveats, but really – anything is better than modifying the core.
If disk space is not the issue but just download speed as in my case…
The issue I was facing was the the client was not paying attention to size or dimension for the feature image uploads. The theme is a responsive theme and works well with the range of image heights and scaling to the desired image width in the page. So it was possible to upload very large files and not notice the size if sitting on a high speed network.
I added custom image sizes, used a plugin to force regeneration and modified the theme to display the custom size instead.
I’ve had a similar problem: a client website should generate bigger thumbs. I’ve ended up building a plugin with a custom Image Editor, like this:
The IM_Image_Editor_GD extends WP_Image_Editor_GD, changes the _resize function (who calls
image_resize_dimensions
) to call an internal version of it, like this:Hope this helps and sorry about my English!
You can manage with this plugin visit https://wordpress.org/plugins/simple-image-sizes/
Simple Image Sizes
This plugin allow create custom image sizes for your site. Override your theme sizes directly on the media option page. You can regenerate all the sizes you have just created and choose which one you wanted to regenerate. You can now get all the code to copy and paste to your function theme file. Now you can use the generated sizes directly into your posts and insert images at the right size ! Now you choose if you want display the size in the post insert image. Now you can regenerate the images one by one in the ‘Medias’ general pane. Now you can regenerate the images by bulk action in the ‘Medias’ general pane. Now you can regenerate the image sizes on single attachment edit page.
The default image sizes of WordPress are “thumbnail”, “medium”, “large” and “full” (the size of the image you uploaded). These image sizes can be configured in the WordPress Administration Media panel under Settings > Media. This is how you can use these default sizes with the_post_thumbnail():
see also full documentation in http://codex.wordpress.org/Function_Reference/the_post_thumbnail
Nevermind, I changed the core. Hurts me on the inside, but for this projects it’s the best solution.