News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

New Thumbnail problem with latest nightly build

Started by jjk, July 12, 2009, 12:51:52 PM

Previous topic - Next topic

jjk

Updated Description of this Problem!

Hi,

Soeren's latest thumbnail images fix in the VM 1.1 nightly build seems to have produced a new problem  ;)

In nightly build 1851 2009-07-11 there is a new 'ugly' behavior on the browse pages when 'Enable Dynamic Thumbnail Resizing?' is disabled and a thumbnail width is set. (This behavior applies to other thumbnail settings as well)

Usually I set the 'Thumbnail Image Width' and leave the 'Thumbnail Image Height' blank, so that the aspect ratio of the Thumbnail Images is maintained. This way VirtueMart is capable of showing i.e. 4 images in a row with a width of 175px, which are evenly lined up on the browse page.

If I leave the height value blank (and I want to continue to do this in order to maintain the aspect ratio) I get the following error message twice above thumbnails in 'landscape format' on the screen. Warning: Division by zero in D:\xampp\htdocs\Joomla15\administrator\components\com_virtuemart\classes\ps_product.php on line 1403

Thumbnails in 'portrait format' are still shown without the error message above!
See screenshot below.

ps_product.php
if( $resize && ! $using_resized_image) {
if( $height < $width ) {
line 1403: $width = round($width / ($height / PSHOP_IMG_HEIGHT));
$height = PSHOP_IMG_HEIGHT;
} else {
$height = round($height / ($width / PSHOP_IMG_WIDTH ));
$width = PSHOP_IMG_WIDTH;
}


With the new code you have to set both, Thumbnail Image Width and Height to a fixed value in order to get rid of the error messages. In cases like mine (Selling art, where most paintings have a different aspect ratio) most of the thumbnails become heavily distorted, when you have to set fixed values for all tumbnail images.

Would be nice if this would be adjusted to the way it worked before.
(I'm not going to show heavily distorted thumbnails to my customers! ;))
On the flypages the Thumbnails are still ok.




[attachment cleanup by admin]
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations


jjk

Hi Peter,

I think this problem is different from the one addressed in the link you supplied:

1. The new "Resizing code" supplied by 'doorknob' should not be applied to the thumbnails when the 'Dynamic Thumbnail Rezising' is disabled.

2. The new "Rezising code" was implemented by yourself before build 1839 2009-06-29 (actually on 2009-06-23 according to the changelog). However, build 1839 didn't have the problem I described.

3. It's a new problem that showed up after upgrading from build 1839 to build 1851 this morning and was not present with your recent fix of class.image2thumb.php.

I suppose Soeren's Thumbnail related changes from the 30th of June are causing the new problem. The class.image2thumb.php you changed on the 23rd of June didn't change again until now and it was working with your fix.

So I bet the problem is a new one (after your/doorknob's fix) :D
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations


jjk

Never used the tracker before - but I will try tomorrow ;)

Thanks

PS: Perhaps meanwhile somebody using the latest VM 1.1 nightly build can shortly disable "Dynamic Thumbnail Resizing" in the VM Configuration - Site settings, leave the 'Thumbnail Height' blank and see if the error message shows up, too and let me know the result here - just to find out if it really is a bug with that latest nightly build.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

jjk

I didn't report this problem in the tracker yet.

However, I think I found the problem although I'm still php illiterate.
Seems to be a typo(?) in line 1364 of ...administrator/components/com_virtuemart/classes/ps_product.php (build 1851)

The problem disappears if I change the line from:

if(PSHOP_IMG_RESIZE_ENABLE == '1' && $resize==1) { (build 1851 2009-07-11)

to what it looked like in build 1837:

if(PSHOP_IMG_RESIZE_ENABLE == '1' || $resize==1) { (build 1837 2009-06-29)

Perhaps the last editor of ps_product.php can check if the 2 characters were changed for a certain reason (causing the problem described above) or if they were typed in accidentially.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations


jjk

Quote from: aravot on July 14, 2009, 21:33:24 PMMake sure both width and height have values.

If I do that, the new thumbnail rezising code produces more problems than it solves (at least for my art gallery website)

The primary problem with the current code is that it requires both, the width and height values and then produces a calculated rezised thumbnail even if you set "Enable Dynamic Thumbnail Rezising" to OFF (unchecked) in VM - Administration - Configuration - Site Tab.

I can't use preset values for width and height, because when you sell art, the aspect ratio of art images varies widely. Currently I have 1200+ individually optimized thumbnails which all have the same width of 175px (so I can always place 4 of them in a row), but vary in height - no thumbnail rezising required! If I set the width value in the new code to 175px, which is what I want it to show, ANY height value does produce many distorted thumbnails.

I love the old code! ;D
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

aravot

If the above fix (your fix) works use it, both width and height require value should not be empty, the code automatically re-sizes base on portait/landscape.

jjk

I certainly will use the workaround I found yesterday (Hopefully it will not produce other errors)

Just wondering - if you want to keep the Thumbnail Resizing code like it is now, you could delete the "Enable Dynamic Thumbnail Rezising" option, because actually the user doesn't have the option to disable it. ;)

BTW - one of the world's most popular gallery sites, the Saatchi Online Gallery in the UK shows 100.000's of distorted thumbnails, because they don't know how to handle it with their Typo3 system. So very ugly thumbnails might not always scare away website visitors  :D
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations