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

Easy dynamic thumbnail generation

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #81  
Old 02-12-2007, 05:07 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Easy dynamic thumbnail generation

I have this working (kind of) in 4.1.6 and it is sweet. I do have one problem though. What I did was added your "mouseover" routine to product.tpl uisng "if" statements as to whether the boxes were checked in "Product Detail Options options" in order to move my "detail" photos into the main display next to the description and pricing, and it really works well with products that have detail photos.

By using the "add thumbnail" routine in x-cart and specifying my main photo, it generates the thumbnail and shows it where appropriate. In product.tpl it shows the full size image, which works great for me.

The problem I am having is that for products with detail photos, it also shows the main photo, so in essence it is duplicated. I know this is because of the "include product_thumbnail.tpl" but if I remove it, nothing is displayed for products not having detail photos. I'm pretty sure I need a "if/else" statement that specifies "if" there are detail photos do "mouseover" routine "else" include product_thumbnail.tpl, but don't know the field to check in sql, or the correct syntax. Can you help?

here is what I have...

{if $active_modules.Detailed_Product_Images ne "" && $config.Detailed_Product_Images.det_image_popup eq 'Y' && $images ne '' && $js_enabled eq 'Y'}
{include file="modules/Detailed_Product_Images/popup_image.tpl"}
{/if}
{* Added Dynamic Image Mod *}
{if $active_modules.Detailed_Product_Images ne "" && ($config.Detailed_Product_Images.det_image_popup ne 'Y' || $js_enabled ne 'Y')}
{include file="modules/Detailed_Product_Images/mod_product_images.tpl" }
{/if}
{* / Added Dynamic Image Mod *}

{include file="product_thumbnail.tpl" sharpen="false" overlay="files/cache/trademark.png" overlay_position="9" class="NoBorder" 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"}
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #82  
Old 02-14-2007, 07:22 AM
  Alltribes's Avatar 
Alltribes Alltribes is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 192
 

Default Re: Easy dynamic thumbnail generation

Without digging into the templates myself, I would assume that wrapping the main product image in {if $images eq""}{/if} should do the trick.
__________________
Alltribes.com
Native American Jewelry
Pottery, Baskets, Kachinas & More

X-cart Gold Version 4.0.17 Live
PHP 5.2.6
MySQL 4.1.25
(mt)
Reply With Quote
  #83  
Old 02-14-2007, 01:55 PM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Easy dynamic thumbnail generation

I haven't throughly tested it but, yes it looks like that did it. Thanks.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #84  
Old 04-19-2007, 06:43 AM
 
Cefko Cefko is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 69
 

Default Re: Easy dynamic thumbnail generation

Do i need something special for this plugin, like GD library or something?

It seems it does that {thumb} does not work.. I have all permissions setup to right folder and path in function.thumb.php is correct.
__________________
X-cart version 4.1.7
Apache/2.0.52 (CentOS)
My SQL 5.0.58
PHP Version 5.1.6
Reply With Quote
  #85  
Old 04-19-2007, 11:46 PM
  mitash's Avatar 
mitash mitash is offline
 

X-Adept
  
Join Date: Jan 2006
Location: Australia
Posts: 450
 

Default Re: Easy dynamic thumbnail generation

I would not use this mod.
You would be better of using thickbox.

Search for "thickbox" or "lightbox" from 7dana.
__________________
eCommerce - Strategy / Design / Development / Marketing / Maintenance

Call within Australia:
Phone: 1300 648 274 | Mobile: 0417 241 950
Call outside Australia:
+61 417 241 950 |

Email:
results@mitash.com | Skype: mitashau | Web: www.mitash.com
Reply With Quote
  #86  
Old 04-19-2007, 11:55 PM
 
Cefko Cefko is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 69
 

Default Re: Easy dynamic thumbnail generation

And why not?
__________________
X-cart version 4.1.7
Apache/2.0.52 (CentOS)
My SQL 5.0.58
PHP Version 5.1.6
Reply With Quote
  #87  
Old 04-20-2007, 04:33 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Easy dynamic thumbnail generation

Quote:
Originally Posted by mitash
I would not use this mod.
You would be better of using thickbox.

Search for "thickbox" or "lightbox" from 7dana.

They don't do the same thing.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #88  
Old 04-20-2007, 08:59 AM
  Alltribes's Avatar 
Alltribes Alltribes is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 192
 

Default Re: Easy dynamic thumbnail generation

Quote:
Originally Posted by Cefko
Do i need something special for this plugin, like GD library or something?

It seems it does that {thumb} does not work.. I have all permissions setup to right folder and path in function.thumb.php is correct.

Yes, you need GD installed.
__________________
Alltribes.com
Native American Jewelry
Pottery, Baskets, Kachinas & More

X-cart Gold Version 4.0.17 Live
PHP 5.2.6
MySQL 4.1.25
(mt)
Reply With Quote
  #89  
Old 04-20-2007, 10:07 AM
 
Cefko Cefko is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 69
 

Default Re: Easy dynamic thumbnail generation

Thanks, I have installed GD...

But I can't make {thumb} to work.
Smarty keeps reporting error:
[20-Apr-2007 19:48:49] Error: Smarty error: thumb: image file does not exist in /var/www/html/Smarty-2.6.12/Smarty.class.php on line 1095

It seems that something is wrong with image PATH.... i have tried everything, but it does not work!

{thumb file="images/P/t_16131.jpg" width="850" link="false" hint="false"}

I have tried many instances, full http path, with leading /, but nothing! Still same error

My product.thumbnail

{strip}
{* Strip out http prefix from Full URL *}
{if $usertype eq 'A' || $usertype eq 'P'}
{assign var="tfile" value=$tmbn_url|replace:"`$http_location`/":"../"|replace:"`$https_location`/":"../"}
{else}
{assign var="tfile" value=$tmbn_url|replace:"`$http_location`/":""|replace:"`$https_location`/":""}
{/if}
{if !$class}
{assign var="class" value=""}
{/if}
{if !$sharpen}
{assign var="sharpen" value="true"}
{/if}
{if !overlay_position}
{assign var="overlay_position" value="9"}
{/if}

{if $config.Appearance.show_thumbnails eq "Y"}
{if $tmbn_url}
{thumb file="images/P/t_16131.jpg" width="850" link="false" hint="false"} {*overlay_position="$overlay_position" overlay="$overlay" sharpen="$sharpen" html="class=\"$class\" alt=\"$product|escape\""} *}
{$tfile|replace:" ":""}
{*$product.tmbn_url*}
{else}
<img {if $id}id="{$id}" {/if}src="
{if $full_url}
{$http_location}
{else}
{$xcart_web_dir}
{/if}
/image.php?productid={$productid}
{if $file_upload_data.file_path}&tmp=y{/if}
"
{if $image_x ne 0} width="{$image_x}"{/if}
{if $image_y ne 0} height="{$image_y}"{/if} alt="{$product|escape}" border="0"
{if $align} align="{$align}"{/if}{if $class} class="{$class}"{/if}>
{/if}
{/if}
{/strip}
__________________
X-cart version 4.1.7
Apache/2.0.52 (CentOS)
My SQL 5.0.58
PHP Version 5.1.6
Reply With Quote
  #90  
Old 04-20-2007, 10:19 AM
 
Cefko Cefko is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 69
 

Default Re: Easy dynamic thumbnail generation

I managed to make it work with hardcoded path:

{thumb file="images/T/t_70.jpg" longside="850" link="false" hint="false" overlay_position="$overlay_position" overlay="$overlay" sharpen="$sharpen" html="class=\"$class\" alt=\"$product|escape\""}

but it does not work with dynamic path:

{thumb file="tfile" longside="850" link="false" hint="false" overlay_position="$overlay_position" overlay="$overlay" sharpen="$sharpen" html="class=\"$class\" alt=\"$product|escape\""}

Any clues?

My product_thumbnail.tpl
{* $Id: product_thumbnail.tpl,v 1.19 2007/04/19 06:55:36 max Exp $ Custom mod *}

{strip}
{* Strip out http prefix from Full URL *}
{if $usertype eq 'A' || $usertype eq 'P'}
{assign var="tfile" value=$tmbn_url|replace:"`$http_location`/":"../"|replace:"`$https_location`/":"../"}
{else}
{assign var="tfile" value=$tmbn_url|replace:"`$http_location`/":""|replace:"`$https_location`/":""}
{/if}
{if !$class}
{assign var="class" value=""}
{/if}
{if !$sharpen}
{assign var="sharpen" value="true"}
{/if}
{if !overlay_position}
{assign var="overlay_position" value="9"}
{/if}

{if $config.Appearance.show_thumbnails eq "Y"}
{if $tmbn_url}
{thumb file="images/T/t_70.jpg" longside="850" link="false" hint="false" overlay_position="$overlay_position" overlay="$overlay" sharpen="$sharpen" html="class=\"$class\" alt=\"$product|escape\""}
{$tfile}
{*$tfile|replace:" ":""*}
{*$product.tmbn_url*}
{else}
<img {if $id}id="{$id}" {/if}src="
{if $full_url}
{$http_location}
{else}
{$xcart_web_dir}
{/if}
/image.php?productid={$productid}
{if $file_upload_data.file_path}&tmp=y{/if}
"
{if $image_x ne 0} width="{$image_x}"{/if}
{if $image_y ne 0} height="{$image_y}"{/if} alt="{$product|escape}" border="0"
{if $align} align="{$align}"{/if}{if $class} class="{$class}"{/if}>
{/if}
{/if}
{/strip}
__________________
X-cart version 4.1.7
Apache/2.0.52 (CentOS)
My SQL 5.0.58
PHP Version 5.1.6
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 10:28 PM.

   

 
X-Cart forums © 2001-2020