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
  #71  
Old 10-24-2006, 12:35 AM
 
DanUK DanUK is offline
 

X-Adept
  
Join Date: Dec 2003
Location: UK
Posts: 800
 

Default Re: Easy dynamic thumbnail generation

Hi, got a question about this mod. Do the product exports show the path to the original image i.e. the non cached image path? If so, how would you go about getting a list of cached image paths for various exports?

I'm guessing that whatever code is responsible for displaying the image on the product page can be reproduced to do this.

Thanks

Dan
__________________
4.4.2

and

4.6.1
Reply With Quote
  #72  
Old 10-24-2006, 06:38 AM
  Alltribes's Avatar 
Alltribes Alltribes is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 192
 

Default Re: Easy dynamic thumbnail generation

This mod doesn't make any changes to the exports. The paths of the created thumbnails are not stored in the database, so will not show up in exports. The file name for the thumbs is a md5 hash of the file name and the various parameters you set.

Theoreticaly you could use the code from the plugin that generates the md5 and modify it to store the thumbnail path in the database so it can be exported. Personaly I'm working on loading the path of the first detailed image into the thubmnail table.

Though loading the actual path to the generated thumbnail into that table would be a better solution, it's beyond my current abilities.
__________________
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
  #73  
Old 10-27-2006, 11:52 PM
 
pinklinoleum pinklinoleum is offline
 

Advanced Member
  
Join Date: Aug 2006
Posts: 37
 

Default Re: Easy dynamic thumbnail generation

Hey Alltribes.... i was wondering if i could get your help on this one. i am still struggling to get it to work on 4.X

You can see what i have here:
[url] http://www.motonekoparts.com/product.php?productid=16165&cat=67&page=1

the images show up... but no swapping happens


I have modified the pluggin it in a couple places so the image would load instead of [img]
...was this neccessary? i didn't read any other posts about modifying the plugin, but i couldn't any images to load otherwise.

here is my product_images.tpl

Code:
{* $Id: product_images.tpl,v 1.12 2004/05/28 12:21:05 max Exp $ *} {if $images ne ""} {capture name=dialog} <script language="JavaScript" type="text/javascript"> {section name=image loop=$images} {if {$images[image].image_path} Image{$images[image].imageid} = new Image(); Image{$images[image].imageid}.src = "{$images[image].image_path|replace:"home/content/m/o/t/motonekoparts/html/":""}"; {/if} {/section} </script> <table width="100%"> <tr> <td> <table> {section name=image loop=$images} {if {$images[image].image_path} <tr> <td> {thumb file=`$images[image].image_path` longside="100" link="false" html="alt='`$product.product` '"} </td> </tr> {/if} {/section} </table> </td> <td> <img src="{$images[0].image_path|replace:"/home/content/m/o/t/motonekoparts/html":""}"> </td> </tr> </table> {/capture} {include file="dialog.tpl" content=$smarty.capture.dialog extra='width="100%"'} {/if}
any suggestions? Thanks for sharing this great feature with everyone.

-michelle
__________________
XCART version 4.0.19
Reply With Quote
  #74  
Old 10-31-2006, 06:54 AM
  Alltribes's Avatar 
Alltribes Alltribes is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 192
 

Default Re: Easy dynamic thumbnail generation

You've got a couple errors.

You have an extra { on line 18:

Code:
{if {$images[image].image_path}

You may also want to change that to
Code:
{if $images[image].image_path neq ""}
in case the image_path shows up, but is blank.

After line 20 you removed
Code:
<a href="#" onmouseover="document.main_image.src=Image{$images[image].imageid}.src;">

That's your problem, right there.

Also on line 21 you;re not using the |replace function, yet your thumbs do seem to be loading. Not sure what's up with that.
Code:
{thumb file=`$images[image].image_path` longside="100" link="false" html="alt='`$product.product` '"}
__________________
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
  #75  
Old 10-31-2006, 07:22 AM
 
pinklinoleum pinklinoleum is offline
 

Advanced Member
  
Join Date: Aug 2006
Posts: 37
 

Default Re: Easy dynamic thumbnail generation

yeah, i can see how it wouldn't be working now! i used the final edit from post #7 ....

"Here is the preloading script for 4.0x, now using imageid instead of orderby"


anyways... here is my revised product_images.tpl

Code:
{if $images ne ""} {capture name=dialog} <script language="JavaScript" type="text/javascript"> {section name=image loop=$images} {if $images[image].image_path} Image{$images[image].imageid} = new Image(); Image{$images[image].imageid}.src = "{$images[image].image_path}"; {/if} {/section} </script> <table width="100%"> <tr> <td> <table> {section name=image loop=$images} {if $images[image].image_path neq ""} <tr> <td> <a href="#" onmouseover="document.main_image.src=Image{$images[image].imageid}.src;">{thumb file=`$images[image].image_path` longside="100" link="false" html="alt='`$product.product`' border='0'"}</a> </td> </tr> {/if} {/section} </table> </td> <td> <img src="{$images[0].image_path|replace:"home/content/m/o/t/motonekoparts/html/":""}"> </td> </tr> </table> {/capture} {include file="dialog.tpl" content=$smarty.capture.dialog extra='width="100%"'} {/if}

i think the problem is here:

Code:
<img src="{$images[0].image_path|replace:"home/content/m/o/t/motonekoparts/html/":""}">

when i try and name it as name="main_image" it won't show up


thanks for your help!
-michelle

my version of X-Cart is 4.0.18
__________________
XCART version 4.0.19
Reply With Quote
  #76  
Old 11-02-2006, 08:09 AM
  Alltribes's Avatar 
Alltribes Alltribes is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 192
 

Default Re: Easy dynamic thumbnail generation

Hmm, I'm not sure what to tell you. You definately need the name="main_image" as that's the "hook" the java uses to swap out the main image.

Try removing the quotes around {$images[0].....}.
__________________
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
  #77  
Old 11-02-2006, 10:34 AM
 
pinklinoleum pinklinoleum is offline
 

Advanced Member
  
Join Date: Aug 2006
Posts: 37
 

Default Re: Easy dynamic thumbnail generation

well... after some more trial and error i finally get her working!! yay! thanks again for sharing this with everyone! here is my product_images.tpl for 4.0.18 if it can help anyone else....


Code:
{if $images ne ""} {capture name=dialog} <script language="JavaScript" type="text/javascript"> {section name=image loop=$images} {if {$images[image].image_path} Image{$images[image].imageid} = new Image(); Image{$images[image].imageid}.src = "{$images[image].image_path|replace:"server path to remove":""}"; {/if} {/section} </script> <table width="100%"> <tr> <td> <table> {section name=image loop=$images} {if {$images[image].image_path neq ""} <tr> <td> <a href="#" onmouseover="document.main_image.src=Image{$images[image].imageid}.src;"> {thumb file=`$images[image].image_path` longside="100" link="false" html="alt='`$product.product`' border='0'"}</a> </td> </tr> {/if} {/section} </table> </td> <td> <img src="{$images[0].image_path|replace:"server path to remove":""}" name="main_image" alt="{$product.product}" /> </td> </tr> </table> {/capture} {include file="dialog.tpl" content=$smarty.capture.dialog extra='width="100%"'} {/if}
__________________
XCART version 4.0.19
Reply With Quote
  #78  
Old 11-02-2006, 11:29 AM
 
pinklinoleum pinklinoleum is offline
 

Advanced Member
  
Join Date: Aug 2006
Posts: 37
 

Default Re: Easy dynamic thumbnail generation

i just have one last question for you....


i am using transparent gifs for my thumbs... anyway to preserve that transparency? right now the cached thumbs all have a black background. i tried adding background="transparent" in the HTML, but that didn't work for me.

any thoughts? thanks again,
michelle
__________________
XCART version 4.0.19
Reply With Quote
  #79  
Old 11-03-2006, 06:01 AM
  Alltribes's Avatar 
Alltribes Alltribes is offline
 

Senior Member
  
Join Date: Dec 2004
Posts: 192
 

Default Re: Easy dynamic thumbnail generation

Sorry, I can't help you there. I have no experience at all with image manipulation via PHP. You'll have to hire someone to look at the plugin, or contact Christoph Erdmann.
__________________
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
  #80  
Old 11-05-2006, 03:51 PM
 
pinklinoleum pinklinoleum is offline
 

Advanced Member
  
Join Date: Aug 2006
Posts: 37
 

Default Re: Easy dynamic thumbnail generation

ok, i'll try him. many thanks for your help
__________________
XCART version 4.0.19
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 09:52 AM.

   

 
X-Cart forums © 2001-2020