Jump to content
Latest News: (loading..)
mloeffen

'On The Fly' Auto Thumbnailer using GD Library 2.1

Recommended Posts

OMG I can't believe I have passed this contribution up !!!! Perfect out of the box easy install !!!! Awesome you don't know how much this will make life easier... LOL Its great thanks

 

Nate Welch

mloeffen

homewetbar

and I am sure many others for your work on this contribution...

Share this post


Link to post
Share on other sites

Hi,

Omg what have you done there????

 

1. try putting the sts code before the code from tep_get_image() like:

////
// The HTML image wrapper function
 // "On the Fly" Auto Thumbnailer using GD Library, servercaching and browsercaching
// Scales product images dynamically, resulting in smaller file sizes, and keeps
// proper image ratio. Used in conjunction with product_thumb.php t/n generator.
function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {

// START STS v4.4:
  global $sts; 
	  $sts->image($src); // Take image from template folder if exists.
// END STS v

 

2. delete (the sts code needs to be replaced as i said in point 1 but for a better understanding I showed all the wrong code within your tep_get_image() function):

				 {

// START STS v4.4:
  global $sts; 
	  $sts->image($src); // Take image from template folder if exists.
// END STS v4.4

if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
  return false;
}

// 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) . '"';

if (tep_not_null($alt)) {
  $image .= ' title=" ' . tep_output_string($alt) . ' "';
}

if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
  if ($image_size = @getimagesize($src)) {
	if (empty($width) && tep_not_null($height)) {
	  $ratio = $height / $image_size[1];
	  $width = intval($image_size[0] * $ratio); // Patch osc-060817
	} elseif (tep_not_null($width) && empty($height)) {
	  $ratio = $width / $image_size[0];
	  $height = intval($image_size[1] * $ratio); // Patch osc-060817
	} elseif (empty($width) && empty($height)) {
	  $width = $image_size[0];
	  $height = $image_size[1];
	}
  } elseif (IMAGE_REQUIRED == 'false') {
	return false;
  }
}

if (tep_not_null($width) && tep_not_null($height)) {
  $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
}

if (tep_not_null($parameters)) $image .= ' ' . $parameters;

$image .= '>';

return $image;

 

Now it should work. I use also rc2a and sts 4.5.8 and I'm going to use SEO.

Share this post


Link to post
Share on other sites

I installed this today and while the thumbnails looked much better it does not appear to be cacheing any of them since I can view the items under a given category, switch to a different category (waiting for the picture generation) and then going back to the original category just to sit and wait for the thumbnails to be re-generated.

 

What directory would I check to see if thumbnail files are being generated? Any help? I'm relatively new to osCommerce and have been all over the documentation for OSC as well as this contribution but can't find out why the browsing is so slow.

 

Thanks in advance for any assistance,

HoustonFirefox

Share this post


Link to post
Share on other sites
I can't figure what's going on here. For some reason the thumbnailer won't display the images in this category on my site:

 

http://www.kwdhasit.com/watches-smith-wess...20_121_124.html

 

I've been using this contribution for a few months now with no problems at all.

 

 

I figured it out, some of my picture directories have ampersands in them.

Share this post


Link to post
Share on other sites

could and would you help me with a problem concerning the contribution otf thumbnailer?

i am trying to find out what it is for months now and i am getting nowhere.

 

the error that comes up is:

Warning: is_file() [function.is-file]: open_basedir restriction in effect. File(/includes/languages/dutch/images/icon.gif) is not within the allowed path(s): (/www/htdocs/hancy:/tmp) in /www/htdocs/hancy/admin/includes/functions/html_output.php on line 72

 

and the listing of html_output.php until line 75 is below.

i checked the code with the readme a hundred times and stil can't find where i went wrong.

 

thanks in advance

 

<?php

/*

$Id: html_output.php,v 1.29 2003/06/25 20:32:44 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

////

// The HTML href link wrapper function

function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL') {

if ($page == '') {

die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>Function used:<br><br>tep_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</b>');

}

if ($connection == 'NONSSL') {

$link = HTTP_SERVER . DIR_WS_ADMIN;

} elseif ($connection == 'SSL') {

if (ENABLE_SSL == 'true') {

$link = HTTPS_SERVER . DIR_WS_ADMIN;

} else {

$link = HTTP_SERVER . DIR_WS_ADMIN;

}

} else {

die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL<br><br>Function used:<br><br>tep_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</b>');

}

if ($parameters == '') {

$link = $link . $page . '?' . SID;

} else {

$link = $link . $page . '?' . $parameters . '&' . SID;

}

 

while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

 

return $link;

}

 

function tep_catalog_href_link($page = '', $parameters = '', $connection = 'NONSSL') {

if ($connection == 'NONSSL') {

$link = HTTP_CATALOG_SERVER . DIR_WS_CATALOG;

} elseif ($connection == 'SSL') {

if (ENABLE_SSL_CATALOG == 'true') {

$link = HTTPS_CATALOG_SERVER . DIR_WS_CATALOG;

} else {

$link = HTTP_CATALOG_SERVER . DIR_WS_CATALOG;

}

} else {

die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL<br><br>Function used:<br><br>tep_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</b>');

}

if ($parameters == '') {

$link .= $page;

} else {

$link .= $page . '?' . $parameters;

}

 

while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

 

return $link;

}

 

////

// The HTML image wrapper function

// "On the Fly" Auto Thumbnailer using GD Library, servercaching and browsercaching

// Scales product images dynamically, resulting in smaller file sizes, and keeps

// proper image ratio. Used in conjunction with product_thumb.php t/n generator.

function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {

 

// if no file exists display the 'no image' file

if (!is_file($src)) {

$src = "images/no_image.jpg";

}

Share this post


Link to post
Share on other sites
the error that comes up is:

Warning: is_file() [function.is-file]: open_basedir restriction in effect. File(/includes/languages/dutch/images/icon.gif) is not within the allowed path(s): (/www/htdocs/hancy:/tmp) in /www/htdocs/hancy/admin/includes/functions/html_output.php on line 72

 

and the listing of html_output.php until line 75 is below.

i checked the code with the readme a hundred times and stil can't find where i went wrong.

 

thanks in advance

 

I think the problem is with the open_basedir in /etc/php.ini. Your html_output.php is the same as mine (which works).

 

Do you have access to your php.ini? Mine is not set:

;open_basedir =

 

Some googling on open_basedir will get you on the right track I think :)

 

good luck!

gina

Share this post


Link to post
Share on other sites

Hi,

I am a newbie and am giving this a go to install.

 

Question..... Below it says to check that it says catalog. The path to my oscommerce is www.mywebsite.com/store and not www.mywebsite.com/catalog

 

Below it is: 'DIR_WS_HTTP_CATALOG', '/catalog/'

My file it is: 'DIR_WS_HTTP_CATALOG', '/store/'

 

Can I still install this under my store? If not, does that mean I would have to change all the 'catalog' to 'store'?

Thanks

 

 Step #4 - Verify config settings
In catalog/includes/configure.php

Verify the following code exists (21, 22, 23)


 define('DIR_WS_HTTP_CATALOG', '/catalog/');
 define('DIR_WS_HTTPS_CATALOG', '/catalog/');
 define('DIR_WS_IMAGES', 'images/');
		Note: Check this configuration file to make sure the path is set correctly for both your catalog directory and your images directory.

With the above example, the DIR_WS_HTTP_CATALOG value should be /catalog/ and the DIR_WS_IMAGES value images/. (Notice that it doesn't have a leading slash)

Share this post


Link to post
Share on other sites

i have installed the auto thumbnailer and for the most it works great, love the idea behindit but i have one little problem, the images shown for the products on their individual pages have the images all squashed...and ive tried changing the image h + w parameters in the admin and in the script (the script is unmodified atm) but still all the images are 47px high and approx 170 - 200 width and squashed.

 

Any solutions?

 

spdev

Share this post


Link to post
Share on other sites

Hi Grinse !

 

Thanks for your upgrade: v.2.4

I have using this contrib almost 2 years and never had a problem.

Now I decided to upgrade it to v.2.4, because of problems with server CPU load on my hosting.

 

So what I did. I just replaced these 2 files:

from yours rc2a files\catalog\includes\functions: html_output.php

from yours new files\catalog: product_thumb.php

 

The result is:

 

Fatal error: Call to a member function on a non-object in /home/mysite/www/www/catalog/includes/functions/html_output.php on line 84

 

Ok, then I have returned the old html_output.php and the site work, but the generated thumbs are black and white few pixels points only :'(

 

What is the problem with v.2.4? Can you help?

Share this post


Link to post
Share on other sites

Thank you for your info!

I missed cleaning the replaced files from other contributions (or included the wrong files).

 

But if you had checked these file (html_output) on line 84 you would have seen that (its code for simple template system and some line above (and underneath) sts modification is mentioned. ;)

 

But I fixed that and now just use the fixed (newer version).

 

Btw. the new abilitys are not in includes/functions/html_output (ok in the admin/includes/functions/html_output is one), they are in admin/categories.php.

Share this post


Link to post
Share on other sites

Thank you for your help !

Now the problem with html_output.php is fixed!

 

I also replaced and new files/catalog/product_thumb.php

But this file now produce thumbs like this one:

 

product_thumb.jpg

 

the older product_thumb.php(2 years old) produce correct image:

 

product_thumb-ok.jpg

 

please help me once again

Share this post


Link to post
Share on other sites

I really hope that someone can help me out with the installation of 'On The Fly'. My website is currently running on CRE Loaded B2B vs13.1 and I don't know if this contribution works with it. I have tried to install it myself but it doesn't seem to work. The instructions quite confusing to me. PLEASE HELP.

Share this post


Link to post
Share on other sites

I've installed this on one of my installations with no issues. However, I'm installing it on a client's installation and can't figure out why some of the thumbnails are showing up and some are broken. Any ideas as to why that might be?

Share this post


Link to post
Share on other sites

I had using the very old version, when they can not work on the transparence image (the transparence gone black)! Now, with 2.4, that problem gone. But, there is a big issuse for me. That is, with the old ver, it made thumb image 1 time only and save in folder images/imagecache. When I browser page, with which image has thumb image, the page with read that thumb image. The src of image like this : images/imagecache/xyaadasda_64x83.jpg

But now, althrought the thumb image had been created, when browser page (back, next, refresh ), it alway re makes the image thumb and overwrite in image/ . So, the page with be load very slow (very very slower than the old GD Thumb). And the src of thumb image in this case : /catalog/product_thumb.php?img=images/7in1L.jpg&w=60&h=80 . Server with work so much if alway do like that !

 

How to fix it ? And where in admin panel to config it ?


Paint for VietNamese :

Share this post


Link to post
Share on other sites
I've installed this on one of my installations with no issues. However, I'm installing it on a client's installation and can't figure out why some of the thumbnails are showing up and some are broken. Any ideas as to why that might be?

Anyone have any ideas on what might be causing some thumbs to show but not others? Could it be due to an older version running? How can I check for sure what version the client is running?

Share this post


Link to post
Share on other sites

Hi, I'm testing out a new install of v2.2 on XP Pro running IIS with PHP5.2.5 and MySQL 5. The only contribution is "On The Fly'.

 

Thumbnails are displaying perfectly with Firefox but I'm having trouble with IE. IE is only showing some of the thumbnails and if I refresh the screen then some of the missing thumbnails appear and some of the previously displayed thumbnails disappear.

 

I've increased max_execution_time in PHP.ini but that didn't change anything.

 

Any ideas anyone?

 

Mick

Share this post


Link to post
Share on other sites
Thumbnails are displaying perfectly with Firefox but I'm having trouble with IE. IE is only showing some of the thumbnails and if I refresh the screen then some of the missing thumbnails appear and some of the previously displayed thumbnails disappear.

 

any ideas anyone? works great in Firefox and randomly in IE. It must be something simple since Firefox is ok.

 

Mick

Share this post


Link to post
Share on other sites
any ideas anyone? works great in Firefox and randomly in IE. It must be something simple since Firefox is ok.

 

Mick

 

 

I had the same problem. It was caused by Ultimate SEOs. The fix was to Reset SEO URLs Cache.

Share this post


Link to post
Share on other sites
I had the same problem. It was caused by Ultimate SEOs. The fix was to Reset SEO URLs Cache.

 

Thanks for the suggestion Kalyn. I've reset both the IE cache and thumbnail cache and still the same result :(

 

Not the end of the world - if I can't find a solution to this soon then I'll try out some of the other thumbnail contributions and hopefully one of them will work with my configuration.

Share this post


Link to post
Share on other sites

quick update: This works under a production Apache server so the problem is with IIS rather than with the contribution itself

Share this post


Link to post
Share on other sites
Thanks for the suggestion Kalyn. I've reset both the IE cache and thumbnail cache and still the same result :(

 

Not the end of the world - if I can't find a solution to this soon then I'll try out some of the other thumbnail contributions and hopefully one of them will work with my configuration.

 

Try copying the image source in the address bar and seeing what happens, (http://www.server.com/catalog/product_thumb.php?img=images/sub/pretty_pic.jpg&w=95&h=100 for example).

 

If the image doesn't show up, you can use firefox with the firebug extension to view the errors that the script is generating.

 

In my case, I upgraded the contribution, and it was trying to recreate the thumbnails that already were created with an earlier version. I deleted the thumbnails and it works fine now.

 

-Mike

Share this post


Link to post
Share on other sites

I installed the images outside the default directory contrib so basically my images are stored in images/photos/ since I have a ton of product photos. When I install the script it works perfectly fine, except its reading on the /images/ folder and not the /images/photos/ folder. How can I change the script to read from /images/photos/ instead of /images/

Edited by dainbramaged05

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×