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

'On The Fly' Auto Thumbnailer using GD Library 2.1

Recommended Posts

Hello to everybody!

I am trying to make run a "on the fly" im my osc commerce, but its quite imposible for me right now, i try to install the "otf autothumb v2.4fix3" i replace the files, and upload de mysql file, but when i am trying to enter to the admin./.catalog in this file

 

http://www.soloazar.com.ar/catalog/admin/categories.php?selected_box=catalog

 

apears this error

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /www/soloazar.com.ar/htdocs/catalog/admin/includes/functions/database.php on line 99

 

in the line 99 i have this

 

function tep_db_fetch_array($db_query) {

return mysql_fetch_array($db_query, MYSQL_ASSOC);

}

 

And im really confused, because i dont know how to solve it.

 

The only contribution instaled in the osc, before thisone is the sts template system.

 

Any Help will be eternaly regarded.

Share this post


Link to post
Share on other sites

i'm trying to work with this contrib, but after a recent server change the site has a very strange behaviour.

 

this image

http://www.acquapetshop.it/product_thumb.p..._f84ba50e29.jpg

in firefox works the first time but, if i refresh, causes a 500 error. New refresh, works, new refresh, error. Again and again.

 

I had to disable the product_thumb because i couldn't see any images under explorer, but now the compression is very bad.

 

Any idea on why the error shows up in this way?

Share this post


Link to post
Share on other sites
i'm trying to work with this contrib, but after a recent server change the site has a very strange behaviour.

 

this image

http://www.acquapetshop.it/product_thumb.p..._f84ba50e29.jpg

in firefox works the first time but, if i refresh, causes a 500 error. New refresh, works, new refresh, error. Again and again.

 

I had to disable the product_thumb because i couldn't see any images under explorer, but now the compression is very bad.

 

Any idea on why the error shows up in this way?

 

it is a server error.

contact the admin or check the server log what went wrong.

Share this post


Link to post
Share on other sites

Just wanted to say that in the version I have "otf autothumb v2.4fix3"

 

 

$parameters was being called as $params in the image wrapper function

 

This resulted in no image parameters coming through.

 

MrTickle

Share this post


Link to post
Share on other sites

Can you add extra images with On the Fly or do you have to add other contributions? I dont want to break the store OTF works great.

Share this post


Link to post
Share on other sites
Hoi,

 

Doesn't work with me, it fails to show images. My problem is that I have the site on the root, not in /catalog/. Ive made a catalog/images/thumbnails aswell but that didn't help either.

 

Do I have to make thumbs myself first?. Ive tried to chance the product_thumb but no luck either. I have GD Library 1.60 on my hoster.

 

Any advice?

 

 

Nathalie

 

 

I had the same problem but found out that the program didn't like any spaces in the name of the .jpg i.e. "this one.jpg" as opposed to "this_one.jpg"'

It is good practice to not have spaces in any file names anyways, but just a heads up!

Share this post


Link to post
Share on other sites

Alright, i really can not figure this out. the small pictures will not show in the catalog > Categories / Products in the admin area. this only occurs when i use the coontrib otf autothumb v2.4fix3. it requires the replacement of the function tep_image, and that is where the problem starts. I have edited the $params to the correct $parameters and have replaced the define section in the configuration.php. still no luck. but if i put the original html_output.php in the admin section, the pictures work. i have read thru the entire 25 pages and still no resolve. i am using 2.2rc2a on the below configurations.

 

 

The images and the contrib works great on my local machine setup below:

Server OS:

Database: MySQL 5.0.27-community-log

Server Date: 07/06/2008 00:18:09

Datebase Date: 07/06/2008 00:18:08

Server Up Time:

HTTP Server: Apache/2.2.3 (Win32) PHP/5.2.0

PHP Version: 5.2.0 (Zend: 2.2.0)

 

 

 

 

 

the images and the contrib does not work on the Linux host:

Server OS: Linux 2.4.21-53.ELsmp

Database: MySQL 4.1.22-max-log

Server Date: 07/05/2008 23:19:28

Datebase Date: 07/05/2008 23:19:28

Server Up Time: 23:19:28 up 61 days, 47 min, 0 users, load average: 3.23, 3.29, 3.34

HTTP Server: Apache

PHP Version: 4.3.11 (Zend: 1.3.0)

Share this post


Link to post
Share on other sites

Now I need your advice,

 

I reconfigured the html_output.php on the admin side.

 

////
// The HTML image wrapper function
 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
// BOF - Modification: On The Fly Auto Thumbnailer
   // Set default image variable and code
   $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 (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;

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


   $image .= '>';

   return $image;
  }
// EOF - Modification: On The Fly Auto Thumbnailer

 

 

 

 

 

it works and shows the small pics in the catagories but was wondering if there is a better way of writing this?

 

thx

Matthew

www.rogersdvds.com

Share this post


Link to post
Share on other sites

ok, think i finaly got it figured out. ignore the above 2 posts as all the problems were due to a missing space.

 

in step 7 it has you replace the html wrap. do that but look for the following:

 

 

 

if (tep_not_null($alt)) {

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

}

 

 

 

and replace it with:

 

if (tep_not_null($alt)) {

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

}

 

 

hope this helps someone.

 

Matthew

www.rogersdvds.com

Share this post


Link to post
Share on other sites

I was trying to use this contribution to return the thumbnail image name so I could use it as a source in another program. I used tep_image(DIR_WS_IMAGES . $row->image_url, '', 100,100)

 

I was expecting the new image name created in the thumbnails directory to be returned but it just returned the original image name. Am I using this wrong. I have spent over 8 hours working on this. Please help.

Share this post


Link to post
Share on other sites

Looking for some clue why this is happening. Below is an image from IE7 and firefox browser. Also piece of code from admin/categories.php:

english_text.jpg

 

the code:

<tr>
           <td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_URL . '<br><small>' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . '</small>'; ?></td>
           <td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? stripslashes($products_url[$languages[$i]['id']]) : tep_get_products_url($pInfo->products_id, $languages[$i]['id']))); ?></td>
         </tr>

 

thanks.

 

blr044

Share this post


Link to post
Share on other sites

<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
	  <tr>
		<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td>
		<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>
	  </tr>
<?php
}
?>

 

Vger

Share this post


Link to post
Share on other sites

Soory Vger, I guess I need to explain this a little better. I have added image of the whole page.

 

image002.jpg

 

Where ever at admin -> catalog -> categories/product -> add product the language text appears, is where the ussue is. I did try your code, but as one can see, it did not solve the issue.

 

blr044

Share this post


Link to post
Share on other sites

Hoping someone might be able to help me out with this...

 

osC 2.2RC2 + Ultimate SEO URL + STS 4.58 w/modernrc2a template

 

I'm getting the following 'missing image error' with table_background_ images on all of the pages:

 

ProductThumb.jpg

 

Image Properties:

.../product_thumb.php?img=includes/sts_templates/modernrc2a/images/table_background_products_new.gif&w=50&h=50

 

Product Images work perfectly fine (Product Image Properties - .../product_thumb.php?img=images/Product_01.jpg&w=100&h=100)

 

And the template images work perfectly fine as well (Example - .../includes/sts_templates/modernrc2a/images/arrow_east_south.gif)

 

Right now, I have to go through most of the files and cut out the header code

<?php
//            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_delivery.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT);
//            </td>
?>

 

Here is my html_output.php - I'm gathering my problem might have something to do with the image scaling code.

// 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 = '') {

// + STS 4.58
global $sts; 
$sts->image($src); // Take image from template folder if exists.
// - STS 4.58

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

           [color="#FF0000"][b]// 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 '';
       }
   }[/b][/color]

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

Share this post


Link to post
Share on other sites

Bug Report

 

In version: "On the fly Auto Thumbnailer 2.4 fix 3 + Trucolour/better resampling for GIF better GIF transparency support + minor palette fix"

By DJStealth 7 Sep 2008

 

in catalog/includes/functions/html_output.php this line is found:

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

 

it should be:

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

 

Please include in next version, i don't have the time to fix this myself

regards

Edited by Olof Larsson

Share this post


Link to post
Share on other sites

Wow i am having the same issue as a bunch of other folks. Did the missing background images get solved yet ?

 

My installation is in the root of the site. The server is running PHP5 Everything was fine when i did a fresh install locally. So when i did a new install on the live server the problem showed up which has me thinking it is a permissions error but i am not sure. Heres the properties of the missing images.

 

product_thumb.php?img=images/table_background_products_new.gif&w=56&h=40

Share this post


Link to post
Share on other sites

Hi All,

 

Would like to know that, how do i prevent Auto Thumbnailer from resizing the spacer.gif at the size of 1px x 1px ... because it messy the theme design that used spacer image.

 

i have tried following,

 

// Don't calculate if the image is set to a "%" width

if (strstr($width,'%') == false || strstr($height,'%') == false || strstr($width,'1') == false) {

$dont_calculate = 0;

} else {

$dont_calculate = 1;

}

 

and even

 

// Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)

if (!strstr($image, 'pixel') || (!strstr($image, 'spacer')) {

$dont_calculate = 0;

} else {

$dont_calculate = 1;

}

Share this post


Link to post
Share on other sites
Hi All,

 

Would like to know that, how do i prevent Auto Thumbnailer from resizing the spacer.gif at the size of 1px x 1px ... because it messy the theme design that used spacer image.

 

i have tried following,

 

// Don't calculate if the image is set to a "%" width

if (strstr($width,'%') == false || strstr($height,'%') == false || strstr($width,'1') == false) {

$dont_calculate = 0;

} else {

$dont_calculate = 1;

}

 

and even

 

// Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)

if (!strstr($image, 'pixel') || (!strstr($image, 'spacer')) {

$dont_calculate = 0;

} else {

$dont_calculate = 1;

}

 

 

Hi, anyone know how to solve this ?

 

Thanks

Share this post


Link to post
Share on other sites
Soory Vger, I guess I need to explain this a little better. I have added image of the whole page.

 

image002.jpg

 

Where ever at admin -> catalog -> categories/product -> add product the language text appears, is where the ussue is. I did try your code, but as one can see, it did not solve the issue.

 

blr044

 

Hi everybody,

 

I had same problem as decribed above picture. I prepared quick and easy solution.

 

First of all open admin/includes/configure.php file and add below line

//new configuration start
define('DIR_FS_CATALOG_LANGUAGES_SPECIAL','../includes/languages/');
//new configuration end

 

Now open admin/categories.php file:

 

Find below configuration

 

DIR_WS_CATALOG_LANGUAGES

 

Replace with new configuration value

 

DIR_FS_CATALOG_LANGUAGES_SPECIAL

 

Hava a nice day.

Share this post


Link to post
Share on other sites

Does anyone know of an easy way to uninstall this contribution? It doesn't seem to work with Spooks Enhanced Listings contribution in the thumbnail view, and I'd rather have the thumbnail view. It keeps making another thumbnail, but 300+wide although the height seems to stay the same as the other thumbnail.

 

Hope I'm making sense, it's late and I'm exhausted. I'm concerned about the changes made to the sql database and I don't want to screw that up.

 

Thanks in advance.


Debora

Breaking code.... one website at a time.

Vibrators: like cute little puppies without the puppy breath. Who can't like a vibrator?

Life Tip: Taking yourself too seriously? Put on a penis hat and look in the mirror every 5 minutes. That should fix it.

"Finally found the ball gag for those damn voices. Now to pull out the whip...." - Me

Member of the CODE BREAKERS CLUB - WE RULE!

Share this post


Link to post
Share on other sites
Hello,

 

I've installed this contribution, it's great, works perfectly...

But I have one small problem...

In picture box, next to the picture is blank spase that colors black... I want it to colors white... I allready tryed settings (255,255,255) in the administrator but it dosen't change anything...

Take a look here http://www.novodom.si/index.php

 

I hope someone will have a solution for my problem..

 

Best regards,

David

 

i have same problem.

any solution?

Share this post


Link to post
Share on other sites

Hi guys,

I need your help. I have installed this contrib without any problems and it works perfect for me, but:

 

Where is my huge .jpg-image in the header? It says "no image", but i am pretty sure there has been a 960*240 jpg-image... :rolleyes:

Share this post


Link to post
Share on other sites

I installed this contribution several months ago and all seemed OK, but yesterday while trying to debug a "division by zero" warning, I came accross these other PHP Warnings in my error_log that I think are du to this contribution...

 

[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagecreate() [<a href='function.imagecreate'>function.imagecreate</a>]: Invalid image dimensions in /var/www/catalog_live/product_thumb.php on line 310, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagecolorallocate(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 313, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagefill(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 315, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagecolortransparent(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 316, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagecopyresampled(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 350, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagegif(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 377, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagecreate() [<a href='function.imagecreate'>function.imagecreate</a>]: Invalid image dimensions in /var/www/catalog_live/product_thumb.php on line 310, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagecolorallocate(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 313, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagefill(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 315, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagecolortransparent(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 316, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagecopyresampled(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 350, referer: http://catdads.rlknight.com/product_info.php?products_id=86
[Tue Nov 18 10:03:12 2008] [error] [client 172.16.88.5] PHP Warning:  imagegif(): supplied argument is not a valid Image resource in /var/www/catalog_live/product_thumb.php on line 377, referer: http://catdads.rlknight.com/product_info.php?products_id=86

 

Am I correct in assuming that these warning are being generated by this contribution? Can someone tell me how to trouble shoot them, or how to fix the problem?

 

Thanks,

Rick

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

×