Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Set a max width on product images?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-30-2007, 05:08 AM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default 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!
__________________
~ Andrea Beight
Reply With Quote
  #2  
Old 08-29-2007, 09:26 AM
 
reefland reefland is offline
 

Member
  
Join Date: Apr 2005
Posts: 16
 

Default 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.
__________________
4.0.19
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:02 AM.

   

 
X-Cart forums © 2001-2020