X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Easy dynamic thumbnail generation (https://forum.x-cart.com/showthread.php?t=22308)

JWait 02-12-2007 05:07 AM

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"}

Alltribes 02-14-2007 07:22 AM

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.

JWait 02-14-2007 01:55 PM

Re: Easy dynamic thumbnail generation
 
I haven't throughly tested it but, yes it looks like that did it. Thanks.

Cefko 04-19-2007 06:43 AM

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.

mitash 04-19-2007 11:46 PM

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.

Cefko 04-19-2007 11:55 PM

Re: Easy dynamic thumbnail generation
 
And why not?

JWait 04-20-2007 04:33 AM

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.

Alltribes 04-20-2007 08:59 AM

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.

Cefko 04-20-2007 10:07 AM

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}

Cefko 04-20-2007 10:19 AM

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}

Cefko 04-20-2007 10:26 AM

Re: Easy dynamic thumbnail generation
 
I got it now

I should use

{thumb file="$tfile" ....

and not

{thumb file="tfile" ...

Damn $$$$$$!!!

ProMuscles 05-08-2007 02:51 AM

Re: Easy dynamic thumbnail generation
 
Cefkl can you post your code

Wambli 05-20-2007 06:57 PM

Re: Easy dynamic thumbnail generation
 
I can't seem to get this to work I get the large image no thum nail this is what it says

[img]images/cache/75f39e7784e8a3ebdcfc27282918244a.jpg[/img]

please help my product.tpl look like this


{* $Id: product_images.tpl,v 1.12 2004/05/28 12:21:05 max Exp $ *}
{if $images ne ""}
{capture name=dialog}
<table width=100%>
<tr>
<td>
<table>
{section name=image loop=$images}
{if $images[image].image_path|replace:'server path to remove':''}
<tr><td>{thumb file=`$images[image].image_path` longside="100" link="false"}</td></tr>


{/if}
{/section}
</table>
</td>
<td>
<img src={$images[0].image_path|replace:'server path to remove':''} name="main_image"/>
</td>
</tr>
</table>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_detailed_images content=$smarty.capture.dialog extra='width="100%"'}
{/if}

What am I doing wronge?

Wambli 05-20-2007 06:58 PM

Re: Easy dynamic thumbnail generation
 
I can't seem to get this to work I get the large image no thum nail this is what it says

[img]images/cache/75f39e7784e8a3ebdcfc27282918244a.jpg[/img]

please help my product.tpl look like this


{* $Id: product_images.tpl,v 1.12 2004/05/28 12:21:05 max Exp $ *}
{if $images ne ""}
{capture name=dialog}
<table width=100%>
<tr>
<td>
<table>
{section name=image loop=$images}
{if $images[image].image_path|replace:'server path to remove':''}
<tr><td>{thumb file=`$images[image].image_path` longside="100" link="false"}</td></tr>


{/if}
{/section}
</table>
</td>
<td>
<img src={$images[0].image_path|replace:'server path to remove':''} name="main_image"/>
</td>
</tr>
</table>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_detailed_images content=$smarty.capture.dialog extra='width="100%"'}
{/if}

Wambli 05-20-2007 07:18 PM

Re: Easy dynamic thumbnail generation
 
so sorry about the double post!! does anyone have this working in 4.1.6 I really like this mod but can't get it to work

JWait 05-21-2007 10:15 AM

Re: Easy dynamic thumbnail generation
 
Wambli

Just a suggestion, but did you replace the parts that say "server path to remove" with the path to your server? It should be something like "home/wambli/public_html/".

Wambli 05-21-2007 04:58 PM

Re: Easy dynamic thumbnail generation
 
Thanks Just wait I changed the path and it still doesn't work does it have something to do with the fact I'm running 4.1.6 I still get this instead of thum nail

[img]images/cache/75f39e7784e8a3ebdcfc27282918244a.jpg[/img]

my code:

{* $Id: product_images.tpl,v 1.12 2004/05/28 12:21:05 max Exp $ *}
{if $images ne ""}
{capture name=dialog}
<table width=100%>
<tr>
<td>
<table>
{section name=image loop=$images}
{if $images[image].image_path|replace:'home/omagruen/public_html/xcart/':''}
<tr><td>{thumb file=`$images[image].image_path` longside="100" link="false"}</td></tr>


{/if}
{/section}
</table>
</td>
<td>
<img src={$images[0].image_path|replace:'home/omagruen/public_html/xcart/':''} name="main_image"/>
</td>
</tr>
</table>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_detailed_images content=$smarty.capture.dialog extra='width="100%"'}
{/if}

I have tired many diffrent paths even hard code still nothing?

JWait 05-22-2007 12:27 PM

Re: Easy dynamic thumbnail generation
 
[img]images/cache/75f39e7784e8a3ebdcfc27282918244a.jpg[/img] ??

It should be "files/cache/75f39e7784e8a3ebdcfc27282918244a.jpg" (the forum screws up the img markers). Did you edit your function.thumb.php to point somewhere else (images)?

Wambli 05-24-2007 06:09 PM

Re: Easy dynamic thumbnail generation
 
Jwait,
nope I didn't change the function.thumb.php ? I weird thing is that is finds the detailed image and displays it,but it will not display the thumbnail?

JWait 05-25-2007 05:47 AM

Re: Easy dynamic thumbnail generation
 
2 Attachment(s)
My bad.. I changed my function.thumb.php :)

In function.thumb.php, mine says..
if (empty($params['cache'])) $_CONFIG['cache'] = 'files/cache/';

What does yours say?

Also, the detailed image is probably where it is supposed to be (where you told X-cart to put it) so that isn't a problem.

I have uploaded my product_images.tpl (actually mod_product_images.tpl) so you can check it against what you have. It is kind of unique but you should be able to compare it to what you have (or simply "call" it by replacing your "include") to check your setup. It goes in skin1/modules/Detailed_Product_Images. I've also included blank_dialog.tpl which is pretty self-explained. It goes in /skin1. They are both for version 4.1.6.

I'm wondering, do you have the thumbnails on your server? The function.thumb.php will create them the first time a customer opens the page. Using either FTP or Cpanel look for the folder name "cache" and see if there are any of the thumbnails in it. The folder needs to have a htaccess with "Allow from all" (without quotes) in it and the folder needs to have writable permissions. Just make several of the folders where you think they may need to be (root, /xcart, /images, etc.) and one of them should fill up with thumbnails in no time. You may need to adjust your function.thumb.php to write the thumbnails where you want them.

nfc5382 05-27-2007 11:11 AM

Re: Easy dynamic thumbnail generation
 
Thanks for the info. This is a great mod. Had to debug it slightly to get it to work.

Here is my file for 4.0.x:

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:"var/www/html/":""}";
{/if}
{/section}
</script>
<table width="100%">
<tr>
<td>
<table>
{section name=image loop=$images}
{if $images[image].image_path}
<tr>
<td>
<a href="{$images[image].image_path|replace:"var/www/html/":""}" 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:"var/www/html/":""}" sharpen="false" class="NoBorder" name="main_image" alt="{$product.product}" />
</td>
</tr>
</table>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_detailed_images content=$smarty.capture.dialog extra="width=100%"}
{/if}


Few things....

1. There is an updated plugin. Get it here: http://www.cerdmann.com/xtras/smarty/function.thumb.php

2. The link to # didn't work well with my CDSEO site. If you click on the link, the page would go back to the site root. For CDSEO I had to modify the link
from

Code:

<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>

to
Code:

<a href="{$cdseo_prod}/{$product.cdseo_url}#" 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>

3. my 'server path to remove' is obviously "var/www/html/"...

nfc5382 05-28-2007 05:19 PM

Re: Easy dynamic thumbnail generation
 
You need to add the following around section loops to not show disabled pictures!

Code:

{if $images[image].avail eq "Y"}...{/if}

Keebz 06-12-2007 10:13 AM

Re: Easy dynamic thumbnail generation
 
Hi, great mod! I have it working perfectly as I want on the product detail pages.

I was wondering...has anyone incorporated this into product listing/subcategory indexes? I'm not sure if I should be editing customer/main/products.tpl or product_thumbnail.tpl, nor am I sure of what I'm supposed to be putting in there.

This snippet of code in either of those files results in an error {thumb file=`$images[image].image_path` longside="100" link="true"}. Says the file parameter is empty.

Any insight would be awesome.

**Edit
Found answer in this thread http://forum.x-cart.com/showthread.php?t=24233

JWait 06-18-2007 04:43 AM

Re: Easy dynamic thumbnail generation
 
This mod does what you want. I don't know about anything "quicker".

dub713 06-18-2007 05:49 AM

Re: Easy dynamic thumbnail generation
 
Quote:

Originally Posted by JWait
This mod does what you want. I don't know about anything "quicker".


am i really missing something here? but i just haven't seen how a mod that dynamically creates thumbnails from one large image handles the creation, layout and deployment of the rollovers. i thought the mod was purely for the thumbnail creation to help people from having to do the manual work in an editor. we've got our thumbnails already so that didn't matter to me.

i'll read back through in a sec and give it another test (i'm on 4.1.7) , but i may be back with some questions...

thanks,
j

JWait 06-18-2007 06:09 AM

Re: Easy dynamic thumbnail generation
 
Check the tpls at the beginning of the thread. Our site is doing exactly what you are asking. We are using version 4.0.19, but I also have it working in 4.1.6. This "mod" creates thumbnails "on the fly" and you can call them wherever you like, and however you like.

Also see alltribes.com for an example of what I think you are looking for.

dub713 06-18-2007 07:14 PM

Re: Easy dynamic thumbnail generation
 
1 Attachment(s)
okay...

finally. i'm somewhat there.

i've gotten a rollover to work. but, i need a bit more. i'll get to that in a sec.

i'm not stupid, really, but i've been up for a day trying to beat a deadline, so forgive me if i sound slow right now but these are some questions i have...

do we just install the images like normal, but just calling the same one for multiple image usages? i was tired and floundering around, so, upload one image, call it multiple times. does it have to end up in the normal image dir? with the T D C P and all that stuff?

also, the code that was posted to move the images up to the top section, into product, instead of product_images does not appear to work for 4.1.7. the code where you remove this...

Code:

{capture name=dialog}

and

Code:

{/capture}
{include file="dialog.tpl" content=$smarty.capture.dialog extra='width="100%"'}


and the other chunk from another file.

i end up with the background removed from the lower images, and no rollovers at all for the top set in the new placment in product, and the old ones in product_images. see attached.


and i guess for now, here's my major problem...

it'll be easier to just see what's there now to understand what i need. i need the rollover to show the color variants, but those are not really the detail shots.

we only take one close-up, detailed shot that is cropped in on the artwork. since the large, and the fullsize images are not the same size, i'd like to have the rollovers for the 2 color variants, but if you click on either of the images, you get the standard pop up showing the close up view of th art. we don't want to have the large close up in the page with the rest of the images.

take a look here and you'll see what i mean.. http://www.gama-go.com click on men's tees and look at the variants and how they work.

anyone have something like that figured out? or have any ideas?

thanks,
j

Steve-C 07-26-2007 06:14 AM

Re: Easy dynamic thumbnail generation
 
Can anyone explain how to install GD Library, please? I can find where to get the download but just where do I put it in the filesystem.

I'm on a Linux server with PHP version 4.4.4 (Which it seems is supposed to have GD built in but I can't find it anywhere)

Thanks

Zaja 07-26-2007 08:27 AM

Re: Easy dynamic thumbnail generation
 
Quote:

Originally Posted by Steve-C
Can anyone explain how to install GD Library, please? I can find where to get the download but just where do I put it in the filesystem.

I'm on a Linux server with PHP version 4.4.4 (Which it seems is supposed to have GD built in but I can't find it anywhere)

Thanks


Read this:
http://www.onlamp.com/pub/a/php/2003/03/27/php_gd.html

Steve-C 07-26-2007 10:20 AM

Re: Easy dynamic thumbnail generation
 
Thanks Zaja.
Looks like that rules me out !

JWait 07-29-2007 08:00 AM

Re: Easy dynamic thumbnail generation
 
I'm running into a problem using this on version 4.1.x. It seems that the folder the images are stored in is fixed at /images/T, /images/D, etc.

When I try to upgrade my sql database from 4.0.19 to 4.1.x my photos get moved from the file system to the database and will not show up until I use the "regenerate cache" feature and move the photos from the database back to the file system. As an added frustration, it appears the photos in the /images/T folder are not overwritten, but appended by adding "-01", "-02" etc, and the appended photo becomes the one xcart looks for. Needless to say, this seems like a tremendous waste of my limited disk storage space.

Any ideas?

Steve-C 08-01-2007 01:28 AM

Re: Easy dynamic thumbnail generation
 
I would love to get this mod working but I have fuddled about with it for a while and get absolutely nothing at all, not even an error message. The site just carries on as normal!

My host says GD support is enabled
I've added the latest Cerdemann plug-in
I have created /image/cache directories everywhere with 777 read/write & none have any images in.
I've tried most of the modules/Detailed_Product_Images/product_images.tpl files that have been posted
I've made sure the code doesn't say [img]

There is no sign of anything happening on the "view source" for the pages.

I'm obviously doing something fundamentally wrong. Could anyone give me a pointer, please?

Thanks
Steve

JWait 08-01-2007 02:05 AM

Re: Easy dynamic thumbnail generation
 
Steve,

The plugin should create a series of photos in the images/cache that is in the same directory as your xcart installation if it is working properly. It will create these the first time a customer looks at the page the photo is on.

It sounds like you have done everything correctly, and it should be working. The only thing I can think of is did you clear the templates_c directory before trying the various tpl files?

Steve-C 08-01-2007 02:24 AM

Re: Easy dynamic thumbnail generation
 
Hi

Yes, I've cleared the templates cache.

The only thing I can see that i haven't done is "Make sure you disable the detailed product images popup"

I'm not sure how / where to do that.

Thanks

JWait 08-01-2007 02:56 AM

Re: Easy dynamic thumbnail generation
 
In admin, click "modules" then look for "Detailed Product Images" and click "Configure' to the right. "Display detailed images in a popup window:" should be unchecked.

When you go to a product page on your customer side what does it show as the path when you right click on the image and choose "properties"?

Steve-C 08-01-2007 03:04 AM

Re: Easy dynamic thumbnail generation
 
Ahh, I was looking for something more complex, like code modding!

It didn't help, though!

when I right click on the image it shows the normal full path to the image file /shop/images/P/xxxxx.jpg

JWait 08-01-2007 03:14 AM

Re: Easy dynamic thumbnail generation
 
And you have a /shop/images/cache/ directory? Is anything in it?

OpheliaPayne 08-03-2007 11:59 AM

Re: Easy dynamic thumbnail generation
 
Editing to remove my post.

I did not realize that this mod does not affect the actual product image, only detailed images.

JWait 08-04-2007 05:44 AM

Re: Easy dynamic thumbnail generation
 
Quote:

Originally Posted by OpheliaPayne
Editing to remove my post.

I did not realize that this mod does not affect the actual product image, only detailed images.


Actually it does affect the product image, dynamic thumbnail generation is just that, it makes thumbnails automatically from full size photos.

It works fine in all areas using the 4.0.x versions of xcart. The problam I am having in the 4.1.x verisons is that I need to disable the methods that xcart is using to save thumbnailed photos and can't figure out where it is doing this.

Steve-C 08-04-2007 07:26 AM

Re: Easy dynamic thumbnail generation
 
Hi JW

Sorry I went missing.

Yes, I have an /images/cache/ at every level including /skin1/.
Each has 777 permissions and has an .htaccess file "allow from all".
Nothing in any of them !


All times are GMT -8. The time now is 08:56 PM.

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