Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Animated GIF images not working on site, but do work in Admin


golfman2006

Recommended Posts

We have the contribution 'On the Fly' Auto Thumbnailer using GD Library installed which automatically creates the thumbnails for us. When we upload an animated GIF image through Admin, the image is correctly animated in the admin pages, but on the website, this is not the case. If you look in the new products boxes on the front page or the product info pages or each product, you will see static images instead of waving flags. I have looked through all the forums and even uploaded the images manually using FTP and Binary mode....but still, the images are not animated.

 

Any help or direction would be greatly appreciated!

Link to comment
Share on other sites

****UPDATE****

 

Found out that the Animated GIFs are working on the Product pages upon clicking on the "Click to Enlarge" link found here. However, they do not appear animated in the Product page prior to clicking the enlarge. They also are not animated in the New Products module on the front page and Product Listing module.

 

In doing some research, it appears the reason that some GIFs are animated or not is whether the image being displayed is a Thumbnail or not. In our New Products module found here, these images that are being called are from product_thumb.php.gif so it seems to me that the issue relates to the thumbnails that are being created.

 

Anyone have any ideas where I can look to get the thumbnail images also output as animated GIF's?

Link to comment
Share on other sites

You can't use an autothumbnailer on an animated gif. It will result in a thumbnail of just one frame which is what you are seeing. There may be "smart" thumbnailers out there that will do what you want but I've never heard of one.

 

You will need to seperate the frames, resize each manually, and recreate the animated gif.

 

However... imo the thumbnailer is doing you a favor. Animated gifs have no business on a commercial website. In general they look amateurish and erode faith in the site. Flash is only slightly better. The one exception I would make to that would be an interactive flash file that lets you rotate the product to see it from all sides.

 

hth

Link to comment
Share on other sites

  • 1 year later...

I realize this is a couple years late, but I have a client that occasionally uses animated gifs - everything else is jpg - and yes, even though it's not fashionable or hip, it works for his business and he knows how to make them - so, i edited the "On the Fly" Auto Thumbnailer using GD Library to simply ignore any gifs from processing. I searched for code for this for a long time and didn't find it for this particular contribution. I hope this helps someone. Basically in the function tep_image in catalog/includes/functions/html_output.php - I added one if statement:

 

This:

 

if(stristr($src, '.gif')) {

$dont_calculate = 1;

}

 

Here's the whole function so you can see where to slam it:

 

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

}

// 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 NOT PROCESS GIFS - jeemdesign.com

if(stristr($src, '.gif')) {

$dont_calculate = 1;

}

// END - DO NOT PROCESS GIFS -jeemdesign.com

 

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

}

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...