Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

'On The Fly' Auto Thumbnailer using GD Library


stefane321

Recommended Posts

I everybody,

 

I installed contribution 'On the Fly' Auto Thumbnailer using GD Library

 

On catalog side it work great.

 

But on admin side I got a problem.

 

It always give me a broken link to no_image.jpg

 

The problem look to be around this:

 

admin/includes/functions/html_output.php

 

Fonction : tep_image()

 

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";
 }
// 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;
}

// Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)
if (!strstr($image, 'pixel')) {
	$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 not the original size
		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 (tep_not_null($params)) $image .= ' ' . $params;

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

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

$image .= '>';

return $image;
}

 

After a lot of tryout, I found the problem is particulary around this part of the fonction:

 

 if (!is_file($src)) {
 $src = "images/no_image.jpg";
 }

 

It always react like if $src is empty.

 

Can you help me please?

 

Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...