Jump to content
Rickharris

'On the Fly' Auto Thumbnailer using GD Library

Recommended Posts

Please does somebody know how to uninstall "'On the Fly' Auto Thumbnailer using GD Library"?

 

I haven't tried uninstalling this contrib but have you tried using the installation readme.html file as a reference to retrace your steps? since no changes are made to the SQL database it should pretty much just be a reversal of what was done to the files (that are specifically noted to make backups of) and of course the removal of the "product_thumb.php" files. If you need clips of those "original" files, make a specific note to the ones you need and I will do my best to help you out.

Share this post


Link to post
Share on other sites

Hi guys

 

Im another poor soul having the problem where instead of getting the thumbnails, i get the red x. Most people with this problem seem hellbent on not giving the correct info about their install which is why i guess most of these problems remain unanswered.

 

Well here is my setup. Anyone got any ideas?

 

url = http://193.133.70.12/catalog

 

As you can see, the top 3 items on the offers section were added by me and have the red x problem. Why do the others look ok? Is this because they were added before this contrib was installed?

 

The server is w2000 running iis and php 5.1.2

 

My GD Settings are:

 

GD Support enabled

GD Version bundled (2.0.28 compatible)

FreeType Support enabled

FreeType Linkage with freetype

FreeType Version 2.1.9

T1Lib Support enabled

GIF Read Support enabled

GIF Create Support enabled

JPG Support enabled

PNG Support enabled

WBMP Support enabled

XBM Support enabled

 

The lines in the top of my config.php file are:

 

define('HTTP_COOKIE_DOMAIN', '193.133.70.12');

define('HTTPS_COOKIE_DOMAIN', '');

define('HTTP_COOKIE_PATH', '/catalog/');

define('HTTPS_COOKIE_PATH', '');

define('DIR_WS_HTTP_CATALOG', '/catalog/');

define('DIR_WS_HTTPS_CATALOG', '');

define('DIR_WS_IMAGES', 'images/');

define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 

Anything else i need to share?

Share this post


Link to post
Share on other sites

Could this be used for the manufactuer logo too.

 

Trying to get my head around forcing the logo in the left column to be a max width (say 150), but not restricting the 'Heading Image Width' (or atleast haveing a different size say 300.

 

W

Share this post


Link to post
Share on other sites

For some reason, my thumbnails are not displaying on my product listing page. They appear fine (and working with the contrib) in the product info page. I tried a few things, but they didn't work so I'm on here -- the land of no answers -- hoping to get an answer.

 

Not working: http://import-tech.net/store/index.php/cPath/21_22_23

 

Working: http://import-tech.net/store/product_info..../products_id/81

 

product_listing.php image code:

 

tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)

 

I'm using STS, so here is the code from sts_product_info.php (which template/product_info.php.html pulls from):

 

tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"')

 

I already tried putting the latter code in place of the first, but it didn't work. I'm not sure what the problem is, but product_listing.php is only pulling "images/".

Share this post


Link to post
Share on other sites

Well, I double-checked to make sure the thumbs were appearing on another page aside from just the product info page. I added a product with an image into the cart, and the thumb showed up. So, I opened up shopping_cart.php, found the image code, and replaced the one in product_listing.php with it. It worked! So, my issue is solved:

 

Code:

 

tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)

Share this post


Link to post
Share on other sites
Well, I double-checked to make sure the thumbs were appearing on another page aside from just the product info page. I added a product with an image into the cart, and the thumb showed up. So, I opened up shopping_cart.php, found the image code, and replaced the one in product_listing.php with it. It worked! So, my issue is solved:

 

Code:

 

Odd, but it has reverted back to only calling "images/" rather than the image. :angry:

Share this post


Link to post
Share on other sites

Hi,

 

I'm having a strange problem with v1.5 of this contribution. If I set $use_truecolor to true and $use_resampling to true, the thumbnails look nice and smooth, but lose their transparency - this shouldn't be a problem, but if I set $use_truecolor to false, with $use_resampling set to true, the thumbnails don't appear to be resampled at all. In fact there does not appear to be any difference in image quality whether $use_resampling is true or false, provided that truecolor mode is off.

 

To test this, I tried setting truecolor mode to on, but resampling to off, and the images became jagged again. So something weird is going on. The server is running PHP 4.4.2 and the GDLib version is listed as 'bundled (2.0.28 compatible)', so everything should be up-to-date and support resampling etc.

 

Anyone have any ideas? Is this likely to be a problem with how PHP/Apache/GDLib etc. are set up on the server, or a logic error in the product_thumb.php code, or something completely different?

 

The images being used are .gifs, would .pngs make any difference?

 

Many thanks!

 

Dan

Share this post


Link to post
Share on other sites

If you can use the png that will be the best. But you need to change the header to create a png thumbnail from gif images and the code to setup the transparency.

Share this post


Link to post
Share on other sites
If you can use the png that will be the best. But you need to change the header to create a png thumbnail from gif images and the code to setup the transparency.

 

I've been experimenting with the code a bit today, and I've got it to take a .gif with transparency and output a .png thumbnail. This works well because it allows me to use truecolor mode, which for some reason seems to be the only way resampling will work, while still keeping the transparencies. In Firefox at least...

 

There is a well-known bug in Internet Explorer that prevents it from properly displaying transparent areas of .png file. Although there are several ways around this (mostly using an MS-specific CSS call to 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(...)' I can't get any of them to work.

 

I thought maybe this was because I was passing product_thumbs.php?img=... etc. as the image source to the AlphaImageLoader thing, so I tried some basic caching that would let me pass an auto-generated thumbnail-size .png file to AlphaImageLoader. Still no luck though...

 

I'm starting to think a different approach might be in order... would it be possible to alter product_thumb.php so that transparencies will work in truecolor mode? I'm still not sure why the resampling option doesn't make any difference when truecolor mode is off... Anyone have any ideas?

 

Dan

Share this post


Link to post
Share on other sites

In the OSC update dating 17th of august (The 2.2 Milestone 2 060817 Update) there were some modifications to the html_output.php in catalog/includes/functions. Can anyone tell me if there is an update available for the auto thumbnailer, after this update was published? This is the code section which was updated:

 

Old:

// "On the Fly Thumbnailer" using PHP GD Graphics Library by Nathan Welch (v1.5)
// 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 = '') { 

// Set default image variable and code
	$image = '<img src="' . $src . '"';

// Don't calculate if the image is set to a "%" width
	if (strstr($width,'%') == false || strstr($height,'%') == false) { 
	$dont_calculate = 0; 
} else {
	$dont_calculate = 1; 		
	}	

// Do we calculate the image size?
	if (CONFIG_CALCULATE_IMAGE_SIZE && !$dont_calculate) { 

	// Get the image's information
			if ($image_size = @getimagesize($src)) { 

				$ratio = $image_size[1] / $image_size[0];

				// Set the width and height to the proper ratio
					if (!$width && $height) { 
			$ratio = $height / $image_size[1]; 
			$width = intval($image_size[0] * $ratio); 
		} elseif ($width && !$height) { 
			$ratio = $width / $image_size[0]; 
			$height = intval($image_size[1] * $ratio); 
		} elseif (!$width && !$height) { 
			$width = $image_size[0]; 
			$height = $image_size[1]; 
		} 

		// Scale the image if larger than the set width or height
					if ($image_size[0] > $width || $image_size[1] > $height) { 
			$rx = $image_size[0] / $width; 
			$ry = $image_size[1] / $height; 

			if ($rx < $ry) { 
				$width = intval($height / $ratio); 
			} else { 
				$height = intval($width * $ratio); 
			} 

			$image = '<img src="product_thumb.php?img='.$src.'&w='.tep_output_string($width).'&h='.tep_output_string($height).'"';
		}

	} elseif (IMAGE_REQUIRED == 'false') { 
		  return ''; 
	} 
} 

// Add remaining image parameters if they exist
	if ($width) { 
	$image .= ' width="' . tep_output_string($width) . '"'; 
} 

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

if ($params != '') { 
	$image .= ' ' . $params; 
} 

$image .= ' border="0" alt=" ' . tep_output_string($alt) . ' "';

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

$image .= '>';		

return $image; 
}

 

 

New:

////
// The HTML image wrapper function
 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
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);
	} elseif (tep_not_null($width) && empty($height)) {
	  $ratio = $width / $image_size[0];
	  $height = intval($image_size[1] * $ratio);
	} 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;
 }

 

Does it need updating, or will the old code be safe to use? Can't really tell it by looking at it myself.

Share this post


Link to post
Share on other sites

Hi, thanks for great contribution :-)

 

I noticed that when I click on my images on the frontpage (new products of the month), I get the whole url for the icon_newarrival.gif that I use, only when I click on the products image. When I click on the new arrival image, I get the correct url (ny, which is new in norwegian). It looks like this:

 

CODE

http://www.kjolebutikken.com/oscdemo1/incl..._newarrival.gif

 

What is supposed to show when clicking on the products image is the title of the product.

 

I have installed the "Search friendly URL v.1.10" contr. and I have also installed the "New products icon v.1.0." contr.

 

I'm not sure which gives me this problem, but I did not notice it before installing the thumbnail creator.

 

 

Here is url to mits if you want to take a look:

 

http://www.kjolebutikken.com/oscdemo1/index.php

 

 

Hope anyone can help :-)

Thanks

 

Kjolebutikken


Best regards

Kjolebutikken

Share this post


Link to post
Share on other sites
I cant understand the pink error message... what it says?

 

I reads : "my images are not displayed, please help me"

 

Just kidding :-;

 

change your configure.php permissions to 755 and you will have the answer :-)

Share this post


Link to post
Share on other sites

Hi there,

 

Just wondering if you can set the image size with this contribution.

 

I know it will distort my pictures, but that doesnt worry me... I'd rather have the same size images (100 x 80 px for example) so it doesnt look messy.

 

Thanks in advance,

 

Mel

Share this post


Link to post
Share on other sites

We've noticed that the site stats are showing product_thumb.php as getting the largest number of hits, 7 times as many as index.php, is this normal?

Share this post


Link to post
Share on other sites

Hi all,

 

Since I changed hosting a month ago I keep getting many black pixels all around the newly generated thumbs, see http://www.18carati.com/jewellery/gioielli...ne-c-66_77.html

 

I never had such a problem on the old server. If I create an image at a time the problem seems to disappear, if images are more then 2 or 3 then the problem comes back again.

 

Any ideas why ?

 

Thanks

Edited by Tomcat

Outside links in signatures are not allowed!

Share this post


Link to post
Share on other sites

great contribution. Got it working pretty quick, just had to turn on $use_resampling to true to get nice looking images, otherwise they were still blury.

Share this post


Link to post
Share on other sites

small problem guys please help.....

 

all the images show till i install this mod, when i put html_output.php to my includes/funtions folder suddenly the jpegs stop loading the gifs load fine but the jpegs dont load, so any ways to by pass it or there is sumthing wrong with my servers gd library, coz my admin cp tools show it is enabled and is working fine any suggestions?

Share this post


Link to post
Share on other sites

Hi all,

 

Sorry if this has been covered before (although I did search the topic first). I have installed version 1.51 of this mod and it is doing a fantastic job. However, whenever I click on a thumbnail on my product_info.php page to enlarge the image, the image is displayed with a white margin around each edge and the bottom of the image is cut off by the browser's status bar.

 

Is there any way I can stop the status bar being displayed in the pop-up window or manually fudge the height of the image to account for this? Or is my CSS file adding unnecessary margins to the pop-up image?

 

Many thanks for any help or advice you can offer. :D

Share this post


Link to post
Share on other sites

Please ignore my last post. I've realised that the enlarged image is handled by popup_image.php and has nothing to do with the Auto-Thumbnailer script. I've found a possible fix on the CRE Loaded site which I'll try out.

 

Thanks anyway! :blush:

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

×