Jump to content

Archived

This topic is now archived and is closed to further replies.

freakenstein

TimThumb for OScommerce

Recommended Posts

In my opinion Timthumb is currently one of the better and easiest thumbnailscripts available. Often used in WordPress templates, but I decided to use it in OScommerce. With these easy steps you can actually do the same.

 

Let me know what you think and if this can be improved:

 

1. Create the thumbnailcache (/cache) in the OScommerce root and give this directory 777 rights.

 

2. Get timthumb.php from timthumb.googlecode.com.

 

3. In timthumb.php change:

 

if ($new_width == 0 && $new_height == 0) {
   $new_width = 100;
   $new_height = 100;
}

to

if ($new_width == 0 && $new_height == 0) {
   $new_width = $width;
   $new_height = $height;
}

 

4. Upload timthumb.php to your OScommerce root

 

3. Now we're gonna edit /includes/functions/html_output.php

 

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
   $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

 

to

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="/k/catalog/timthumb.php?src=' . tep_output_string($src) . '&w=' . tep_output_string($width) . '&h=' . tep_output_string($height) . '&zc=0" border="0" alt="' . tep_output_string($alt) . '"';

 

That's it.

More info about TimThumb:

www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/

code.google.com/p/timthumb/]l]

 

/Frank

Share this post


Link to post
Share on other sites

correction:

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="/k/catalog/timthumb.php?src=' . tep_output_string($src) . '&w=' . tep_output_string($width) . '&h=' . tep_output_string($height) . '&zc=0" border="0" alt="' . tep_output_string($alt) . '"';

 

should be

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="/catalog/timthumb.php?src=' . tep_output_string($src) . '&w=' . tep_output_string($width) . '&h=' . tep_output_string($height) . '&zc=0" border="0" alt="' . tep_output_string($alt) . '"';

Share this post


Link to post
Share on other sites

Hi...

 

Not worked for me.

When I make any changes that you indicate I lose all the images on the web


Killo tu ere de Dos Hermanas... ;-))

Share this post


Link to post
Share on other sites

Hi...

 

Not worked for me.

When I make any changes that you indicate I lose all the images on the web

 

Same here. Any solutions?

Share this post


Link to post
Share on other sites

×