![]() |
free Dynamic Images module released
The Dynamic Images module has been released, it's a free (basic) alternative to Telafirma's solution. I put this together since Telafirma has pretty much disappeared, and I kept having requests from customers to develop a solution.
This isn't an out-of-the-box replacement of all Telafirma's features in their Dynamic Image Generator mod, as their mod has a image resizing handled in pretty much any area of X-Cart possible, in addition to supporting Thickbox-style popups. While Dynamic Images can easily do everything Telafirma's mod does (and more), someone will need to put in a bit of elbow grease to get to that point. Read more about the module here (Third Party Addons forum): http://forum.x-cart.com/showthread.php?t=41911 Here's a page using the module (note, the popup functionality is an implementation of Lytebox, which was implemented separately): http://www.phpsitesolutions.com/x-cart-variant-addons/variant-chart-module.html |
Re: free Dynamic Images module released
Just a note, to anyone that tried to get one of the free mods and experienced an error, please try again.
I had made a change to process orders with a total of $0 to automatically be processed, but didn't expect the resulting behavior from X-Cart. The error was reported to me by a customer, and has been corrected :-) Sorry for the inconvenience. |
Re: free Dynamic Images module released
Jon you are a LEGEND! Off to have a read and by the looks of that example, it rocks and is BETTER than TelaFirma's! Thank you!!
|
Re: free Dynamic Images module released
Brilliant - will this flip images based on variant choices? - this is the real problem a customer has with the Telefirma mod
|
Re: free Dynamic Images module released
are you referring to how X-Cart replaces the product thumbnail with the variant image upon selection of the dropdown value?
|
Re: free Dynamic Images module released
yep - thats the one
|
Re: free Dynamic Images module released
I have been playing with this mod and it does not appear to deal with variant images. If you have a primary product image, but also have variant images, the default variant image will override the primary product image on the product page and it will not be resized (at least by default).
I have figured out a simple mod to keep the primary product image from being replaced by the variant image, either by default or upon selection of a different variant from the corresponding variant popup. Now I'm trying to figure out how to simply display thumbnails of all the variant images directly on the product page (leaving the primary product image as the main image), and I'd like to use the Dynamic Images mod to automatically size the thumbnails. I've managed to create a template that loops through the variants and accesses their images: Code:
{* $Id: customer_tn_options.tpl,v 1.24 2008/08/25 05:19:21 svowl Exp $ *} I've placed an include for this code in the product.tpl just below the product details. This code displays the variant images, but at full size. The smarty "thumb" directive is attempting to call on the Dynamic Images mod to resize the variant images, but the mod expects a the URL path to the image as a string and I'm using the image.php method of referencing the images. I can't figure out how to reference them by URL. If anybody knows how to do this, I'm very anxious to get this figured out. Thanks! Fritz |
Re: free Dynamic Images module released
I've answered my own question. I'll post my solution as soon as it's finished. Thanks!
EDIT: See this thread for the Dynamic Variant Images Display mod I just completed: http://forum.x-cart.com/showthread.php?t=41998 |
Re: free Dynamic Images module released
looks like I'm several posts behind, glad you got it sorted :-) new mod looks great
|
Re: free Dynamic Images module released
btw, 01bodyjewellery, I haven't had a chance to test the effect of variants with this mod, contact me through email, I'll see what I can do
|
Re: free Dynamic Images module released
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /var/www/vhosts/sitonthis.ca/httpdocs/us/include/templater/plugins/function.thumb_imp.php on line 507
Warning: imagedestroy(): supplied argument is not a valid Image resource in /var/www/vhosts/sitonthis.ca/httpdocs/us/include/templater/plugins/function.thumb_imp.php on line 653 Is the warning msg I keep getting. Also is there a way for me to edit the thumbnail height? I'd like to just set a standard img size for all thumbnails accross the entire site. Any help would be great. |
Re: free Dynamic Images module released
Not sure about the errors without digging deeper. If you applied the patch file via the administration, you can open the actual patch file with a text editor and verify that all of the lines of code that were supposed to be changed were indeed changed. For instructions on how to read patch files, see the How To Install Patches FAQ here:
https://secure.qualiteam.biz/customer.php?area=faq&target=view_faq_question&sub ject=536870928 As for the ability to size the thumbnails to a specific height and width, yes you can. Open skin1/product_thumbnail.tpl and find this line of code: Code:
{thumb file="$tfile" width="$image_x" link="false" hint="false" overlay_position="$overlay_position" overlay="$overlay" sharpen="$sharpen" get_image_path="$get_image_path" html="class=\"$class\" alt=\"`$alt`\""} After the width="$image_x" declaration add: Code:
height="100" crop="true" Change the "100" to your desired thumbnail height. Note that $image_x is the value you set for thumbnail widths in the Admin Settings. The crop declaration forces the image to be resized to the new dimensions while maintaining the original proportions. For more information about the available parameters, see the comments at the top of this file: include/templater/plugins/function.thumb_imp.php. Hope this helps. |
Re: free Dynamic Images module released
That "sorta" worked :) But it changed all the images of the pictures once you get into the product details.
I just need to resize the product page where it's showing multiple products on 1 page. Not the Main picture in the details. I fixed the warning code by restoring my product_thumbnail.tpl file. Apperently I messed with it pretty good :) |
Re: free Dynamic Images module released
This is just off the top of my head, without looking, but that means the product_thumbnail.tpl is used for the category product list thumbnails as well as the product detailed images thumbnails.
That being the case, if you want them to be two different sizes, the best solution might be to make a duplicate of the product_thumbnail.tpl, name it something like product_cats_thumbnail.tpl, change the thumbnail dimensions, and then reference that template instead of the original in the template that builds the product list (can't remember the name of that template off the top of my head). Glad you fixed your other problem. |
Re: free Dynamic Images module released
That worked perfectly. The file I edited to read product_cats_thumbnail.tpl was in File: /customer/main/products_t.tpl
Just for future reference. |
Re: free Dynamic Images module released
I am trying to uninstall the mod because I do not have fcopen enabled and it's throwing up errors when I use it in conjunction with the lytebox mod.
I've uninstalled everything but do not know how to reverse the sql patch. Any help with ths would be greatly appreciated! thank you! |
Re: free Dynamic Images module released
Has anyone gotten this to work with 4.1.11 branch?
|
Re: free Dynamic Images module released
i have 4.1.11
When i go to patch it complains image.php OK skin1/customer/main/product.tpl could not patch skin1/product_thumbnail.tpl could not patch I know product_thumbnail.tpl & product.tpl can be patch manually but i dont know where to insert the code, if there a readme that says find this line and insert after etc etc....? Looking at the Patch code for 4.1.x and the code on 4.1.11 its different. Patch code: --- skin1/customer/main/product.tpl (revision 15) +++ skin1/customer/main/product.tpl (working copy) @@ -13,12 +13,21 @@ <tr> <td class="PImgBox" rowspan="2"> +{* 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} -{include file="product_thumbnail.tpl" productid=$product.variantid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail" type="W"} +{* 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} -{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"} +{* 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"} File to be patched code: <td class="PImgBox" rowspan="2"> {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"} {else} {include file="product_thumbnail.tpl" productid=$product.image_id image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.image_url id="product_thumbnail" type=$product.image_type} {/if} {if $active_modules.Magnifier ne "" and $config.Magnifier.magnifier_image_popup eq 'Y' and $zoomer_images ne '' and $js_enabled eq 'Y' and $printable neq 'Y'} {include file="modules/Magnifier/popup_magnifier.tpl"} {/if} |
Re: free Dynamic Images module released
ok i went ahead and modifed the code manually.
When i uploaded an image and go to my store, where the image is meant to be it says the following error. Warning: Smarty error: thumb: image file "/default_image.gif" does not exist in /var/www/vhosts/houseofman.co.uk/httpdocs/Smarty-2.6.19/Smarty.class.php on line 1092 |
Re: free Dynamic Images module released
anyone?
|
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... |
Re: free Dynamic Images module released
Quote:
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). |
Re: free Dynamic Images module released
does anyone know what you have to modify to get this working with detailed images>?
|
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? |
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? |
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 |
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 :oops: ...and I'm sure it will bite me in the near future.... In function.thumb_imp.php around line 283 change: PHP Code:
PHP Code:
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('/^\//',....... |
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 |
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:
|
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 8O |
All times are GMT -8. The time now is 07:05 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.