Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

'On the Fly' Auto Thumbnailer using GD Library


Guest

Recommended Posts

  • Replies 313
  • Created
  • Last Reply

Top Posters In This Topic

I just noticed my server error log is loaded with tens of thousands of this or similiar error messages. I am using GD Version bundled (2.0.17 compatible) with resampling, true color and jpg all congigured as true.

 

[Tue Oct 5 10:23:45 2004] [error] PHP Notice: Use of undefined constant imagecopyresampled - assumed 'imagecopyresampled' in /usr/home/user/public_html/catalog/product_thumb.php on line 68

 

Anyone have an idea as to what I have done wrong??

Link to comment
Share on other sites

It would be helpful to see a link and an example...  The most likely cause is that you are trying to thumbnail an unsupported file format (only PNG, GIF, and JPG are supported) or that your catalog config, with respect to the image directory is not set correctly.

 

It may also be you have your PHP's errors message turned all the way up on your machine, which is causing the problem... For each call to the thumbnailer, it is trying to output an "undefined variable" message before it makes the thumbnail which may be causing the images not to show up.  (If you call the product_thumb.php by itself, naturally you will get some errors as it is expecting info to be passed along to it)

 

You could try adjusting your PHP's error message settings so they only output *fatal* error warning messages or alter the script to implicity define every variable at the beginning (I know a better, if somewhat outdated PHP coding practice).

 

 

Nate,

 

sorry for the delay in replying, been busy with work.

 

I went and uploaded this to my website for testing, and I get the same thing. Just boxes with little red x's.

I have tried all the combos for turning on and off the options in config, etc...

 

I "believe" my directory is correct. my pictures are located in catalog/images/ (the default location on oscommerce install).

 

The pictures are in .jpg format so shouldn't be an issue.

 

I did a call to the php file to see if there were any errors and this is what I got.

 

Warning: imagecreatetruecolor(): Invalid image dimensions in /home/mutzig2/public_html/catalog/product_thumb.php on line 73

 

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/mutzig2/public_html/catalog/product_thumb.php on line 77

 

Warning: imagefill(): supplied argument is not a valid Image resource in /home/mutzig2/public_html/catalog/product_thumb.php on line 79

 

Warning: imagecolortransparent(): supplied argument is not a valid Image resource in /home/mutzig2/public_html/catalog/product_thumb.php on line 80

 

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/mutzig2/public_html/catalog/product_thumb.php on line 93

 

Warning: imagedestroy(): supplied argument is not a valid Image resource in /home/mutzig2/public_html/catalog/product_thumb.php on line 111

 

Warning: imagedestroy(): supplied argument is not a valid Image resource in /home/mutzig2/public_html/catalog/product_thumb.php on line 112

 

The web host I am using has this version of gd installed:

 

gd

GD Support enabled

GD Version bundled (2.0.23 compatible)

FreeType Support enabled

FreeType Linkage with freetype

GIF Read Support enabled

JPG Support enabled

PNG Support enabled

WBMP Support enabled

XBM Support enabled

 

 

I just don't see what the problem could be? any ideas?

 

The website is located here

www.mutzigcreations.com (just adding to it, and getting ready to open it.)

 

I don't know if this would affect it or not, but I do have the UltraPics contribution installed.

 

Hope this helps, and thank you for your hard work, and time.

 

Doug

Link to comment
Share on other sites

  • 3 weeks later...

Hi Nate.

 

I am a big fan of your contribution. I really like the fact that it resizes the images on the fly.

 

I too would like to see this contribution work with the UltraPics contribution.

 

In that vein I get broken images when I install the UltraPics contrib, and then yours. I get these kinds of image tags on new items. :blink:

<img src="product_thumb.php?img=images/homeworld2/boxcover-sm.jpg&w=75&h=100" width="75" height="100" border="0" alt=" Homeworld 2 " title=" Homeworld 2 ">

 

I haven't been able to figure out why the product_thumb.php didn't get executed. It looks to me like everything is set, and the file just doesn't get called.

Can you give me any clues to fix this?

 

Maybe we could incorporate all of the code in product_thumb.php into the tep_image function? :-"

 

Thanks for any help.

Link to comment
Share on other sites

hi

 

I'm a n00b trying to install this mod. I have a very silly question to ask that will make you slap your forehead repeatedly.

 

in the readme.txt file it says to replace the nep_image function with the provided code.

 

my question is: what is the tep_image function? From where to where to I replace code?

 

do I replace this with the provided code?

 

////

// The HTML form submit button wrapper function

// Outputs a button in the selected language

  function tep_image_submit($image, $alt = '', $parameters = '') {

    global $language;

 

    $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' .

 

tep_output_string($alt) . '"';

 

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

 

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

 

    $image_submit .= '>';

 

    return $image_submit;

  }

 

Sorry for the silly question.

 

Thanks for any info :blush:

Link to comment
Share on other sites

Hi, look after the word function for the function name, which is followed by stuff in parenthesis. The one you have listed below is "tep_image_submit", you want the one in html_output.php (the same file, I think) called tep_image which does the formatting/output of images on the site.

 

You then replace the whole function, much as you have below, beginning with function... and ending with return... }

 

Also, check your store config to make sure the path to your images is correctly specified...

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

Link to comment
Share on other sites

Hi, look after the word function for the function name, which is followed by stuff in parenthesis. The one you have listed below is "tep_image_submit", you want the one in html_output.php (the same file, I think) called tep_image which does the formatting/output of images on the site.

 

You then replace the whole function, much as you have below, beginning with function... and ending with return... }

 

Also, check your store config to make sure the path to your images is correctly specified...

 

thanks for the reply

I understand what you mean about the tep_image function now

but do i replace this?:

////

// 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 = $image_size[0] * $ratio;

        } elseif (tep_not_null($width) && empty($height)) {

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

          $height = $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;

  }

 

////

// The HTML form submit button wrapper function

// Outputs a button in the selected language

  function tep_image_submit($image, $alt = '', $parameters = '') {

    global $language;

 

    $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';

 

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

 

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

 

    $image_submit .= '>';

 

    return $image_submit;

  }

until

return $image;

or

return $image_submit;

 

thanks!

Link to comment
Share on other sites

You see this?

////
// The HTML form submit button wrapper function
// Outputs a button in the selected language
 function tep_image_submit($image, $alt = '', $parameters = '') {

... that's the start of a new function...

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

Link to comment
Share on other sites

I have many stores that pull the pics out of one images folder, like a consolidated images folder. It seems this contribution only works if the images folder is the subfolder of the catalogue (../catalog/images). Can this be modified so that images are create on the fly no matter where the images folder is located?

Link to comment
Share on other sites

Howdy all,

 

I just installed this contribution, but I seem to be getting several errors.

 

when I go to the site all I get are little red x's, if I do the click to enlarge then I can see my pictures.

 

i have the same problem RavenWulf, dod you get it fixed on your site yet?

It worked for the first page I looked at, and then after I just got red X's. strange.

Thanks

Edited by lsd_se
Link to comment
Share on other sites

also, could I ask if this is right in the file renaming?

in the same driectory I have the thumbnails generated as:

 

original: book-bleachers.jpg

thumb: book-bleachers.jpg.thumb.jpg

 

i have red x;'s all over the place, and I double checked my config settings which are correct. /catalog/, images/ etc.

Link to comment
Share on other sites

OK, i figured out the problem, but I don't know how to fix it.

The problem is my cache, it is generating the thumbs, but can't access them after.

I have cache set to false in my product_thumbs.php config now and it works fine.

 

How should I proceed in fixing this?

Edited by lsd_se
Link to comment
Share on other sites

I'm not sure what cache setting your are referring to - perhaps it is the hacked version of this contrib that saves the thumbnails as files?

** Please do not PM with personal support requests (even if offering "payment"). Thank you.

Link to comment
Share on other sites

yes, thumbnails have been generated like this in the same directory as the original image:

 

original: book-bleachers.jpg

thumb: book-bleachers.jpg.thumb.jpg

 

the settings in product_thumbs.php include a cache setting.

 

why do you say it's a hacked version? is it not a contribution from this site?

Link to comment
Share on other sites

Hi Guys,

 

I have a slight problem that I hope you can help me with.

 

So far the my thumbnails are looking great all thanks to this contribution, however I am also using the define main page contrib as well and I am trying to add this code to the main page.

 

<?php  echo '<a href="' . tep_href_link('product_info.php?products_id=664') . '">' . tep_image(DIR_WS_IMAGES . 'HKP-500a.gif', SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

 

The problem is, is that this pic is not picked up and converted to a thumbnail!

 

Can anyone tell me how to fix this because I dont really want to use the full size image!

 

Thanks

 

Mark :-" :'(

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Hi I noticed a problem with this contribution. If a product image filename has a '&' in it, the thumbnail created will be blank. Maybe there's a quick fix for this problem?

 

It doesn't bother me much, but for my clients, they will probably continue to upload images with ampersands in the filenames and complain when the image created is blank.

 

Thanks folks.

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