Jump to content

Recommended Posts

Posted

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).

Posted

Actually, it looks like it might be a cacheing issue as tried it on a new page and it's working OK. :?

Posted

@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
Posted

Thanks Horst, there's some useful options there. I have actually downloaded PIA, but haven't gotten around to using it yet.

  • 8 months later...
Posted

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!!!

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
×
×
  • Create New...