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

free Dynamic Images module released
 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #21  
Old 09-27-2008, 12:21 PM
 
PHPdev PHPdev is offline
 

Member
  
Join Date: Oct 2003
Posts: 18
 

Default Re: free Dynamic Images module released

tomcoleman,

I just installed a clean version of X-Cart 4.1.11 and was able to get this module working. I did have to code all the changes and run the DB script by hand, but since there are only three files to modify it was not to bad.

I'm not sure how much you know so I'll start basic, if this is below you, then please do not take it as an insult...

The default_image.gif is what X-cart uses when an image can not be found, unless you changed this image in the image settings of the admin. Therefore it seems as if you may have not done the coding by hand correctly.

The only thing I had to change to get this working was on the product.tpl I had to use $product.image_url instead of $product.thumb_url as the img src when displaying the image.

Not sure what X-carts default is on this page to show the thumb again or the actual product image... I did not see the thumbnail available to display in the $product options.

Hope this helps...
__________________
PHPdev

---------------------
X-Cart: 4.1.11
OS: Linux
Apache: 2.0.61
Reply With Quote
  #22  
Old 10-18-2008, 02:46 PM
  JWait's Avatar 
JWait JWait is offline
 

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

Default Re: free Dynamic Images module released

Quote:
Originally Posted by PHPdev
tomcoleman,

Not sure what X-carts default is on this page to show the thumb again or the actual product image... I did not see the thumbnail available to display in the $product options.

Hope this helps...

X-cart by default on the individual product page will display the product image (if there is one), then the thumbnail (if there is one and there is no product image), and finally default_image.gif (if there is no images defined).
__________________
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
  #23  
Old 10-25-2008, 04:44 PM
 
xtestedx xtestedx is offline
 

Advanced Member
  
Join Date: Oct 2005
Location: Sydney
Posts: 61
 

Default Re: free Dynamic Images module released

does anyone know what you have to modify to get this working with detailed images>?
__________________
x-cart 4.1.11 yay finally starting to get the hang of this stuff!!
site: www.slixaustralia.com.au
Reply With Quote
  #24  
Old 10-28-2008, 04:25 PM
 
dgreen dgreen is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 85
 

Default Re: free Dynamic Images module released

Jon installed the dynamic image mod for me in the summer but I just noticed that when there is no image for the product, It shows the default_image.gif image, but it also shows an error:
Smarty error: thumb: image file "/default_image.gif" does not exist in /home/dgreen/public_html/Smarty-2.6.19/Smarty.class.php on line 1092

What can I do about this? When there is an image, all looks fine.
Any ideas?
__________________
X-Cart version 4.1.10
upgraded from 4.0.13 myself slowly and with help from xcart forums. Thanks all!

http://www.discountseforim.com
Hebrew Seforim and Jewish Books
Reply With Quote
  #25  
Old 10-29-2008, 07:24 AM
 
PHPdev PHPdev is offline
 

Member
  
Join Date: Oct 2003
Posts: 18
 

Default Re: free Dynamic Images module released

X-cart looks to the default_image.gif when there is no image, sounds like this file is missing or misplaced. On a cart with out dynamic images installed mine resides in the root of the cart directory.

Is that file there?
__________________
PHPdev

---------------------
X-Cart: 4.1.11
OS: Linux
Apache: 2.0.61
Reply With Quote
  #26  
Old 10-29-2008, 11:05 AM
 
dgreen dgreen is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 85
 

Default Re: free Dynamic Images module released

it's in the root folder.
Here is the code from my product.tpl page:


{* PHP Site Solutions - Dynamic Images *}
{if $active_modules.PHPSS_Dynamic_Images ne ""}
{assign var=phpss_dyn_img_width value=$config.PHPSS_Dynamic_Images.phpss_dyn_img_p rodtpl_img_width}
{/if}
{* / PHP Site Solutions - Dynamic Images *}

{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"}
{elseif $product.force_image_type eq 'W' && $product.variantid}
{* PHP Site Solutions - Dynamic Images *}
{include file="product_thumbnail.tpl" productid=$product.variantid image_x=$phpss_dyn_img_width|default:$product.imag e_x product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail" type="W"} 
{* / PHP Site Solutions - Dynamic Images *}
{else}
{* PHP Site Solutions - Dynamic Images *}
{include file="product_thumbnail.tpl" productid=$product.productid image_x=$phpss_dyn_img_width|default:$product.imag e_x product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail" type="P"} 
{* / PHP Site Solutions - Dynamic Images *}
{/if}
{if $active_modules.Magnifier ne "" && $config.Magnifier.magnifier_image_popup eq 'Y' && $zoomer_images ne '' && $js_enabled eq 'Y'}
{include file="modules/Magnifier/popup_magnifier.tpl"}
{/if}

Thank you
Gitty
__________________
X-Cart version 4.1.10
upgraded from 4.0.13 myself slowly and with help from xcart forums. Thanks all!

http://www.discountseforim.com
Hebrew Seforim and Jewish Books
Reply With Quote
  #27  
Old 11-13-2008, 09:29 PM
 
benz benz is offline
 

Senior Member
  
Join Date: Oct 2007
Posts: 111
 

Default Re: free Dynamic Images module released

I've had this problem too - I believe it occurs on sites that do not have their store in the root directory, the problem seems to come from how the path for default_image is calculated, the default image path gets passed to the thumbnail function as something like /store/default_image.gif rather than "http://somedomain.com/store/default_image.gif", the file_exists() check then can't find the image and throws a smarty error around line 283.

I threw in a quick hack to suppress the error message if the thumbnail path started with a /. The rest remains unchanged, as skip_thumb is still set true it will jump through the rest of the code and just return the original thumbnail path, xcart then looks happy.

Having done this nastily I'd love to see the RIGHT way to fix it, as this felt really dirty
...and I'm sure it will bite me in the near future....

In function.thumb_imp.php around line 283 change:
PHP Code:
$smarty->trigger_error('thumb: image file "' $params['file'] . '" does not exist'); 
to
PHP Code:
# benz - nasty hack to suppress the error and skip thumb if its  default_image issue
if( !preg_match('/^\//',$params['file'])) $smarty->trigger_error('thumb: image file "' $params['file'] . '" does not exist');
#/benz 

PS the line break in the code snippet above happened right in the middle of the match part of the regular expression (which is kind of important!), it should read !preg_match('/^\//',.......
__________________
Version 4.1.8
Version 4.1.11
Reply With Quote
  #28  
Old 11-16-2008, 06:10 AM
 
dgreen dgreen is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 85
 

Default Re: free Dynamic Images module released

Thanks for the reply, but I don't seem to have the file function.thumb_imp.php .
Is it in the include/func directory? all of my files there start with func and NOT function.
Is it somewhere else?

Thank you
Gitty
__________________
X-Cart version 4.1.10
upgraded from 4.0.13 myself slowly and with help from xcart forums. Thanks all!

http://www.discountseforim.com
Hebrew Seforim and Jewish Books
Reply With Quote
  #29  
Old 11-19-2008, 03:20 AM
 
benz benz is offline
 

Senior Member
  
Join Date: Oct 2007
Posts: 111
 

Default Re: free Dynamic Images module released

@dgreen

You'll find this file in:
your store directory
/include/templater/plugins

This file is the smarty plugin for the image generator - if you don't have this file then that could be the problem!

There's not actually that much required in the tpl files to make use of this, all they are doing is gathering up images to pass to this file.

From the install package the only truly important thing is the two extra .php files and the writable cache directory for the images - if you're having problems using this on different versions of xcart just try calling the "thumb" smarty function and pass it the path for an image you know exists to check if it works

eg in a tpl file somewhere include:
PHP Code:
{thumb file="images/somebigfile.jpg" width="150" link="false"
You should get back a thumbnail 150px wide. If you don't then you have a problem with the install of the 2 php files or the images/cache directory.
__________________
Version 4.1.8
Version 4.1.11
Reply With Quote
  #30  
Old 11-26-2008, 02:33 AM
 
benz benz is offline
 

Senior Member
  
Join Date: Oct 2007
Posts: 111
 

Default Re: free Dynamic Images module released

One cautionary note, while this all works really well - and I've even now tweaked our admin screens, variants and detailed images to use this with lytebox as well cause we love it so much - at some point uploading a too large image will break things.

We had a client upload a 1.8mb, 300dpi, 1980x3000 jpeg and the entire category that the product was in went missing - you click the category and you get a blank screen. Downsized the image and everything went fine (Images on the file system)

I must admit I haven't checked further yet to see if it was Xcart, the mod or something else that crashed it, but I've got my eye on it now
__________________
Version 4.1.8
Version 4.1.11
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


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 05:48 PM.

   

 
X-Cart forums © 2001-2018