3497 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 more
sevenspark Moderator says

Has anyone come across a way of scaling up / “upsizing” WordPress Post Thumbnails? My understanding is that, by default, WordPress will only generate the registered image sizes for an image upload if the original image is larger than the registered image size.

That is, if you upload a 600×400 image, and you have a registered image size that is 800×600 named “full-size”, the full-size image will not be generated – and therefore when you retrieve the image at full-size, expecting an 800×600, you get a 600×400 instead.

I’ve been thinking about this, and while I think upscaling is a bad idea from a graphical point of view (quality deterioration), I think from a user’s perspective this would be helpful (many users don’t want to deal with image resizing – they just want it to “work”).

I know timthumb can handle upscaling, but I want to use WP’s built in functionality for a variety of reasons. I also know I could scale the images via img tag sizes or CSS , but that (a) changes aspect ratios and (b) doesn’t help situations like images in Nivo Slider.

Anyway, if anyone has come across a clever way to enable WP thumbnail upscaling I’d love to know!

Thanks!

Chris

3430 posts
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Located in United States
  • Has been part of the Envato Community for over 4 years
+1 more
organicbee says

You could possibly use Jquery to do it so it doesnt distort the image http://plugins.jquery.com/plugin-tags/image-resize

also for a wordpress reference http://core.trac.wordpress.org/browser/tags/3.1/wp-includes/post-thumbnail-template.php theres a filter on line 70 that may do what you want in a “hack”

EDIT : and line 62

3497 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 more
sevenspark Moderator says

You could possibly use Jquery to do it so it doesnt distort the image http://plugins.jquery.com/plugin-tags/image-resize

also for a wordpress reference http://core.trac.wordpress.org/browser/tags/3.1/wp-includes/post-thumbnail-template.php theres a filter on line 70 that may do what you want in a “hack”

EDIT : and line 62

Thanks for the info. I may have to end up going with a jQuery solution as a last resort.

The filter on line 70 might help, but I’m hoping to find a way to generate the larger image in the first place (on media upload) rather than adjusting things when it’s ready to output.

Gonna start digging through the media upload code now :)

3497 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 more
sevenspark Moderator says

Well, for anyone who’s interested, I tracked down the code that constrains the image resizing (disallows upscaling).

//From function image_resize_dimensions() line 345-346 of wp-includes/media.php
$new_w = min($dest_w, $orig_w);
$new_h = min($dest_h, $orig_h);

If we were to make this change the limitation would be removed:

$new_w = $dest_w; //min($dest_w, $orig_w);
$new_h = $dest_h; //min($dest_h, $orig_h);

Unfortunately, there is no appropriate action or filter hook to make this adjustment from a theme or plugin. I guess until WP offers this as an option there is no great solution here. I might try using a similar filter to the one mentioned by OrganicBee to generate the appropriate size if necessary.

815 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Contributed a free file of the month
+3 more
rvision_ says

What about image width/height attributes? Probably won’t be XHTML valid, but it solves your peoblem.

3497 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 more
sevenspark Moderator says

What about image width/height attributes? Probably won’t be XHTML valid, but it solves your peoblem.

I appreciate the suggestion :) Unfortunately, like I said in the OP, using img attributes to size the image (a) changes aspect ratios and (b) doesn’t help situations like images in Nivo Slider (which is what I am trying to use the images for). Thanks though!

3497 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 more
sevenspark Moderator says

UPDATE :

I figured out a solution to this issue. It’s a bit involved, but if anyone is interested let me know and I’ll try to do a writeup when I get a chance :)

1 post
  • Has been part of the Envato Community for over 3 years
  • Has collected 10+ items on Envato Market
avenarie says
sevenspark said
UPDATE : I figured out a solution to this issue. It’s a bit involved, but if anyone is interested let me know and I’ll try to do a writeup when I get a chance :)

Hello Sevenspark,

i have the same problem.. i am trying to use featured images as images for the nivo slider, and i am trying to figure out a ways to upsize small images to 960 px width…

the only way i can think of is using timthumb for this….

you said, you found a solution.. can you share it please with me?

thanks, avena

1 post
  • Has been part of the Envato Community for over 3 years
joker_23 says

Yes, sharing your solution with others would be helpful.

167 posts
  • Has been part of the Envato Community for over 5 years
  • Sells items exclusively on Envato Market
partnuz says
sevenspark said
UPDATE : I figured out a solution to this issue. It’s a bit involved, but if anyone is interested let me know and I’ll try to do a writeup when I get a chance :)

So what’s the solution

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by