View Single Post
  #4  
Old 08-30-2003, 07:46 AM
 
Mad Mad is offline
 

Advanced Member
  
Join Date: Jul 2003
Location: Brooklyn, NY
Posts: 60
 

Default

[EDIT] THERE IS A MUCH EASIER AND BETTER WAY POSTED BELOW! THIS ONE IS GOOD IF YOU WANT ALL THE PICTURES SEPERATED FROM EACH OTHER. [/EDIT]

Ok I used this method for both product listings (20x29 pics, example @ http://www.madtech.org/customer/home.php?cat=53) and featured products (70x70 pics, example @ http://www.madtech.org/customer/home.php?cat=103). This is a very dirty hack simply involving file names, it could probably be done better and more cleanly, but fuck it this works. This hack assumes you're using the filesystem to store pics. I won't provide any support for people who cant get it to work, I'm posting this and you can figure it out from there.

First edit your /include/func.php and add the following function at the bottom (anywhere actually). You will need to edit the home directory in the function below.
Code:
function func_get_thumbnail_name($productid) { global $config, $sql_tbl, $xcart_dir, $http_location; if ($config["Images"]["thumbnails_location"] == "FS") { $thumbnail_info = func_query_first("SELECT image_path, image_type FROM $sql_tbl[thumbnails] WHERE productid='$productid'"); if (eregi("^(http|ftp)://", $thumbnail_info["image_path"])) # image_path is an URL return $thumbnail_info["image_path"]; elseif (eregi($xcart_dir, $thumbnail_info["image_path"])) { # image_path is an locally placed image $url = ereg_replace("/home/madtech/public_html/files/", "", $thumbnail_info["image_path"]); return $url; } } return false; }

Now create a file called product_thumbnail_feat.tpl in /skin1/.

Code:
{if $config.Appearance.show_thumbnails eq "Y"} [img]{if $tmbn_name}{$http_location}/path/to/featured/files/{$tmbn_name|replace:[/img]{/if}

Now I don't remember what the original line was, but in /costumer/products_t.tpl basically where it calls for product_thumbnail.tpl replace that with the following. All that's changed is that it points to product_thumbnail_feat.tpl and passes a parameter that we created the function for earlier (tmbn_name=$products[product].tmbn_name).

Now you should be all set, simply get some application that will bath resize all your pics for you, and then rename all the files (there are also tools that will do this for you) to the following. If your original product pic is called example.jpg the new sized photo should be called example.jpg_f.jpg. So all this hack does is add a tag to a filename. If you want to to this to product listings thumnbails, just follow the above steps and instead create a file called product_thumnbail_list.tpl, make products.tpl call for _list.tpl and pass the tmbn_name parameter. That's it!

Good luck to everyone who will attempt this, if you come up with a cleaner hack share the wealth!

Enjoy the hack!
Reply With Quote