X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Set a max width on product images? (https://forum.x-cart.com/showthread.php?t=32890)

abeight 07-30-2007 05:08 AM

Set a max width on product images?
 
Is there an IF statement that can be used on the product image that says if the width of the image is larger than X, use a set fixed width?

For example, I want providers to be able to upload product images that are up to 200 pixels wide. But if they upload an image that is 400 pixels wide, I want the width to be set to 200 pixels in the template so that the large image doesn't mess up the page layout.

TIA!

reefland 08-29-2007 09:26 AM

Re: Set a max width on product images?
 
In /customer/main/product.tpl ( version 4.1.8 ):

Find:
Code:

{elseif $product.force_image_type eq 'W' && $product.variantid}

And
Code:

{if $active_modules.Magnifier ne "" && $config.Magnifier.magnifier_image_popup eq 'Y' && $zoomer_images ne '' && $js_enabled eq 'Y'}


Replace the code in between these two lines with:
Code:

{if $product.image_x > 380}
{include file="product_thumbnail.tpl" productid=$product.productid image_x=380 product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail" type="W"} 
{else}
{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail" type="W"}
{/if} 
{else}
{if $product.image_x > 380}
{include file="product_thumbnail.tpl" productid=$product.productid image_x=380 product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail" type="P"} 
{else}
{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail" type="P"}
{/if} 
{/if}


Replacing 380 with the max width you want.


All times are GMT -8. The time now is 06:51 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.