Hi,
I seem to have an issue I cannot debug, and have tried using regenerate thumbnails, auto-post-thumbnail-pro, and even deleting a featured image, and uploading new file.
E.g.,
I have 700×406 image, set as featured image, cannot get the larger image for home page slider block (large left image, 745×483). No caching. Also, a 650×350 image from older article/theme, won’t enlarge to the “featured” image size for category 700×357.
Not sure if there is some king of image/function setting blocking the moderate enlargement for use in the featured box sizes, but I have cropping “on” in the theme panel, which is needed by the WP image scaler to create larger image (“enlargement”), and have “crop to actual size” on in wp settings > media.
In media, I have thumbnails set to:
small = 100×65
medium = 700×357
large = 745×483
Anyone have an idea why I’m not able to get the enlarged versions generated? Theme should “build these” or the regen plugin “should” do this, but not getting either working.
Directory for images is writable and owned by ftpuser, not server/apache, so not a permissions issue.
Any feedback would be helpful. I am now stumped after messing with this on/off for two days. I even tried deleting ALL thumbnails (!!!) and then manually going back in and reuploading the featured images on 50 posts (OUCH!!!). So, done my due diligence on anything remotely obvious here.
Thanks, everybody.
Hi, Marius
Yikes … is this something I can pay you to add as a feature or extension, or custom plugin for Newspaper? We’ve moved from Woo Canvas, which still supports this function, since “featured” images are often larger than the image in post, particularly legacy content. For instance on some of our news sites we have 400×300 images for many stories, and these can scale up fairly well, as seen here:
http://californianewswire.com/
Basically we need the facility on some sites like CNW (above) to be able to enlarge the images to fit the featured slider, and on the category pages. Not horribly complex, just need the function, perhaps as a checkbox “add scaled images” which would turn on the two thumbs for category and home page slider.
E.g.
here, the main image should scale up to fit slider area
http://ga-ga.com/
and here image should scape up/crop to fit the feature box
http://ga-ga.com/gogaga/lifestyle/
This is worth US$100 to me to make it happen, btw. Or, happy to buy (3) more licenses via ThemeForest ๐
Since everybody seems afraid to use timThumb anymore even with the security fixes, perhaps the vt_resize.php might be considered?
Original:
http://academe.co.uk/2013/08/resizing-of-images-in-wordpress-from-within-a-template/
Fixes for latest WP:
http://www.pirenko.com/blog/2013/01/22/vt_resize-php-image_resize-deprecated/
Since almost every theme developer is now abandoning any kind of image support except what is built into WP, this is problematical for many news sites which have legacy images from many years, not being able to be used to fit the new layout of Newspaper and other themes.
This would mean to have featured home page images, every image would need to be uploaded at the largest possible size used by theme, perhaps 745×483 – which isn’t clear in docs and also is different from what we were doing with v2, where the images were going up as 700×406. So, this mean EVERY image MUST be “GIANT” and then down-sampled for all other sizes. However this isn’t always possible.
This is why plugins like TimThumb and others over the year have been essential for creating complex image layouts where minor enlarge/crop is needed to “fit.”
So, money in hand. This would be another HUGE selling point for your theme, as it’s a VERY critical issue for MOST news sites, and we need it for our legacy news portals.
PLEASE CONSIDER – either as a custom add-on solution, or as a core feature option. I need this ASAP, hence willing to pay for development. This is the *only* thing we’re missing for our sites, right now.
Thanks ๐
OR EXAMPLE CODE:
/* Thumbnail upscale
/* ------------------------------------ */
function alx_thumbnail_upscale( $default, $orig_w, $orig_h, $new_w, $new_h, $crop ){
if ( !$crop ) return null; // let the wordpress default function handle this
$aspect_ratio = $orig_w / $orig_h;
$size_ratio = max($new_w / $orig_w, $new_h / $orig_h);
$crop_w = round($new_w / $size_ratio);
$crop_h = round($new_h / $size_ratio);
$s_x = floor( ($orig_w - $crop_w) / 2 );
$s_y = floor( ($orig_h - $crop_h) / 2 );
return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
}
add_filter( 'image_resize_dimensions', 'alx_thumbnail_upscale', 10, 6 );
ref
http://alxmedia.se/code/2013/10/thumbnail-upscale-correct-crop-in-wordpress/
http://codex.wordpress.org/Plugin_API/Filter_Reference/image_resize_dimensions
***OR***
perhaps use scriplet calling ImageMagick to upscale, since WP now can access ImageMagick vs GD libs if available ?
Hi @Christopher
I’ve played a little with regeneration image stuff, and i see that work to upscale the image with this combination of plugins:
Thumbnail Upscale + Force Regenerate Thumbnails works great for me ๐ Try it
Of course, the issue is needing the images to upscale “when published/uploaded” and not have to delete all the thumbs and regenerate them over and over….
I don’t have a test production site I can test these without possibly damaging them, but will try that out.
Obviously built-in support is still preferable as with existing themes that hook into imagemagick libs (now default support with WP), or which use timthumb or vt_resize.
Since WP now supports ImageMagick as default over GD libs, it seems preferable to use the server side capability to easily resize/crop from top images.
Christopher,
Not hugely helpful but you’ve apparently piqued my curiosity on this one.
Have you considered using a service like http://www.imgix.com/ to store images? The theory is they host the full scale version and then you just pull the correctly cropped version from their servers for each instance you need using their API. It’s quite a robust API from the documentation.
Of course, filtering the correct sizes through your feeds becomes a challenge but seems like a matter of methodical manipulation – manageable.
Well, with a dedicated server with 12 cores (XEON), and 32GB of ECC RAM, RE4 RAID 5, blah blah, we should be able to generate images locally using image tools already on board the system (e.g., ImageMagick, old GD Libs etc.).
For our purposes creating external accounts to handle image creation and placement across multiple news portals is needlessly complex for our needs if we can do it “on site.”
So right now we have a plugin which will create a local “thumbnail set” per theme and media sm/med/lg, and then set featured image from both locally hosted ftp images inserted via relative URL (not using media manager) and will post to media manager; will do the same with external images placed inline, but pulled from the main news hub (not locally hosted); and will also not interfere with locally created articles which have images uploaded via media manager and placed inline at top and flush right within body text.
Testing the next step, which is separate element/task which takes the featured image set either automatically or manually, and then creates the zoomed/cropped/enlarged versions and saves to media location so that theme can pull that size for the featured images on category pages and home page. This also uses the server side built-in image processing horsepower without any external I/O.
Once posted images are further optimized by mod_pagespeed and cached server side.
Stay tuned ๐
I am testing this momentarily, in fact (Fri. May 2, 2014).
Expect either happy face or frowny face once I try this.
Also installing upgrades to our ecom system which is always a barrel of monkeys (for those of you old enough to remember that). ๐
-
This reply was modified 12 years by
simchris.
Well, color me amazed. This actually worked.
1) plugin: Auto Post Thumbnail PRO 1.3 by By Tarique Sani (commercial plugin)
2) plugin: Thumbnail Upscale Version 1.0 By Stanislav Khromov (free via wordpress.org)
My media settings
Thumbnail size: 326×159 (because our old small images were 300×250)
[x] crop thumbnail
Medium Size 700×357 (max width x height)
Large Size 745×483 (max width x height)
Did regen thumbs on old posts, and the slightly smaller article headers were enlarged and properly cropped to fit the home page 4-box slider big pic (745×483), and the category indexes with featured image (700×357).
Did new post with image size of 700×406 placed into top of story, hand selected as featured image, and then it properly zoomed it on front page slider.
So, for me (so far) this combo solves multiple issues/needs for our various sites. How freaking awesome is that. Still need to test on some legacy stuff, but seems to work.
example:
enlarged/cropped thumbnail for category featured image
http://ga-ga.com/gogaga/lifestyle/
Original article with legacy content/image size
http://ga-ga.com/492/growing-older-in-a-youth-oriented-society/
So, for the “older folks” here, this now seems to do what timthumb used to do, although at the moment with “all thumbs on” – this makes 8 thumbs per photo, even smaller pix put as supplemental images. So, a story with 2 images, has 16 image files.
Obviously I need to audit the sizes actually being used and trim a couple of those, maybe 3 sizes out including xxxxx-1074×483.jpg.
๐
-
This reply was modified 12 years by
simchris.
That’s Awesome Christopher!
Will be equally curious to see how it works after the legacy work is done. As we know, legacy is often just another term for broken ๐
Still seems like such a waste to have to do so much for something as simple as that. Maybe WordPress will find another way, or TimThumb will get with the program again.
It’s really something which should be built-in to WordPress, as they now use the ImageMagick library vs GD libs. They (Automattic) are just “philosophically” opposed to image enlargement as they say “it makes things look fuzzy.”
Hence the hacks (plugins) which basically just do the call to the built-in server image processor to over-ride WP turning that off.
For instance there is no real reason tagDiv couldn’t adapt the code found in “Thumbnail Upscale Version 1.0” for use with the theme.
Timthumb works great, but most “modern” theme developers won’t use it, in favor of the built-in WP image processing (basically “select a featured image to make a thumbnail or go away”).
We’ve been using Woo Canvas for some news sites, but have waited to switch to Newspaper due to the image upscale issue. Some savvy themeers use BOTH methods and give you a choice, but most do not, as here. Nothing wrong with that, it just seems like theme devs need to adopt the workaround for accessing server image tools already being accessed by WP anyway, and then over-ride the upscale limitation. Ideally WP should have function for this, but noooooooo.
Next step is to take a legacy site and convert over and see what happens ๐
about 20 lines of code!!!
class ThumbnailUpscaler
{
/** http://wordpress.stackexchange.com/questions/50649/how-to-scale-up-featured-post-thumbnail **/
static function image_crop_dimensions($default, $orig_w, $orig_h, $new_w, $new_h, $crop)
{
if(!$crop)
return null; // let the wordpress default function handle this
$aspect_ratio = $orig_w / $orig_h;
$size_ratio = max($new_w / $orig_w, $new_h / $orig_h);
$crop_w = round($new_w / $size_ratio);
$crop_h = round($new_h / $size_ratio);
$s_x = floor( ($orig_w - $crop_w) / 2 );
$s_y = floor( ($orig_h - $crop_h) / 2 );
return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
}
}
add_filter('image_resize_dimensions', array('ThumbnailUpscaler', 'image_crop_dimensions'), 10, 6);
Basically the same code I’d posted previously, from Stackexchnage, made into a plugin.
I wonder if just appending this to functions.php would work?