Jump to content

upscaling false is ignored


Tyssen
 Share

Recommended Posts

Why is upscaling false being ignored with the following template?

foreach($page->images as $image) :

  $options = array(
    'quality' => 85,
    'upscaling' => false
  );
  $large_img = $image->width(800,$options);
  $thumb_img = $image->size(100,100,$options);

  $img .= '<a href="'.$large_img->url.'"><img src="' . $thumb_img->url .'"></a>';

endforeach;

The page I'm testing has images that are smaller than 800 but the linked versions are all 800px wide (and pixellated because they've been stretched).

Link to comment
Share on other sites

@Tyssen: yes, the pixelated ones are cached versions from before you specified upscaling = false.

If you want to override them you can use one of the following methods:

  1. add a $image->removeVariations() before creating the new ones! Attention: don't forget to remove this once you are ready!
     
  2. since PW 2.5 you also can add 'forceNew' => true to your options array, this forces recreation of the variations every time a page loads! so please be careful and remove it after wards!!
     
  3. you may load Pia, Pageimage Assistant module. She has an option in the modules config page for forceNew that works sitewide if you are in debug mode and logged in as superuser. This way you do not need to alter your template codes and also it does not slow down your page for guest visitors if you forget to disable it. :)
  • Like 6
Link to comment
Share on other sites

  • 8 months later...

Hi,

Today I had the same problem and the upscaling didn't work on pictures with only one value for the size...

So, I only want to say thank you for the tipp with the cache. 'forceNew' => true in the options works great - the reload of the pictures lasts a while, but it works great :-) Thanks!!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...