Autothumbnailer / More Pics Contribution Clash

When we first installed the auto thumbnailer contribution it worked fine, absolutely perfectly. However after installing the other contributions I noticed that even though the extra pics were resizing on the page, the main product image wasn’t, but it was in the product listings and search results. So I sat down today and ran through the PHP code for the contribution to see what had altered. I had a nagging feeling in my mind that the More Pics contribution had overwritten something that the Auto Thumbnailer was relying on.

After digging through the PHP code in the product_info.php page I noticed the line where the main image is printed to the page

document.write('‘ . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT==’false’?”:SMALL_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT==’false’?”:SMALL_IMAGE_HEIGHT), ‘hspace=”5″ vspace=”5″‘) . ‘
‘ . TEXT_CLICK_TO_ENLARGE . ‘‘; ?>’);

Here you can see the additions added by the More Pics contrib
(MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH)
(MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT)

Looking at the code (for anyone who doesn’t know PHP) it essentially says if the constant ‘MOPICS_RESTRICT_PARENT’ is set to false then don’t print anything, otherwise print the small image width/height. However this doesn’t control where the image is pulled from, and in the pages the main product image was coming from the original directory and not the resized image cache directory. After removing the if statement and forcing the small image width/height to be printed suddenly it all worked fine again. I’m sure there’s probably a language file somewhere to change to get the same affect but I certainly can’t work out what to change!

So my code now is
document.write('‘ . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ‘hspace=”5″ vspace=”5″‘) . ‘‘; ?>’);

Which is what it was originally.

Leave a Reply