Jump to content
Rickharris

'On the Fly' Auto Thumbnailer using GD Library

Recommended Posts

TYep...I did read the previous message....but sorry...being a newbie...some of it went over my head.  (pixel black, and separator works fine now!)...  :D

 

The problem only seems to involve the "subcategory" where the products are listed...not in the upper "main categories" that list the subcategories....the alt/text works fine there. 

 

I can't figure....the alt / text also works fine when over a (product pic)....in the subcategory...but not over the top/right pic for the subcategory.

 

Anybody out there have an idea of how to fix?  Thanks...appreciate the help.

Read the 5th post on the 2nd page again - I explained the problem exactly already in laymen's terms - it has nothing to do with the mod...

 

Mods that generate the thumbnail images separately would of course be more efficient, and they could be altered to produce a "resampled" t/n of similar quality. I beleive the issue of server performance was addressed in the second post of this thread....


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

Share this post


Link to post
Share on other sites

Can I get some guidance on what to look for to fix what may be "not or mis-configured" with the GD config? PHP4 comes bundled with it already in there, so I"m not sure what to look at to fix.

 

Oh, and the hottie...we're engaged. Back off. Haha!

Share this post


Link to post
Share on other sites

To make this compatible for GD Versions under 2 change the following line in product_thumb.php

 

$tmp_img = imagecreatetruecolor($_GET['w'],$_GET['h']);

 

to

 

$tmp_img = imagecreate($_GET['w'],$_GET['h']);

 

I'm no php expert, but this worked for me using GD 1.6

Share this post


Link to post
Share on other sites

Seeing this in the error log file on the server:

 

PHP Warning: imagedestroy(): supplied argument is not a valid Image resource in /home/thewebsite/public_html/product_thumb.php on line 35

 

PHP Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/thewebsite/public_html/product_thumb.php on line 27

 

Something to worry about?

 

Thanks...

Share this post


Link to post
Share on other sites

I take it those errors are likely in reverse order? Sounds like maybe your version of GD doesn't support imagecreatetruecolor, in which case I'd replace it with imagecreate in product_thumb.php as Spike_UK suggests...(unless it's having trouble with imagecopyresampled - in which case, replace with imagecopyresized)

 

Thanks for the tip, Spike....


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

Share this post


Link to post
Share on other sites

Still confused as to what you mean by

I'd check the config info for that domain specifically 
Where and what exactly am I checking?

Share this post


Link to post
Share on other sites

See the readme of the contrib - confirm that GD 2 is active for that domain...


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

Share this post


Link to post
Share on other sites

Hi,

 

I tried all the solutions suggested so far in this thread and I still get this error:

 

Parse error: parse error, unexpected '}' in /hsphere/local/home/pzq0qw/aplus-computersonline.com/catalog/includes/functions/html_output.php on line 188
It happens on ALL pages of my site

 

Any suggestions???

 

Thanks

Share this post


Link to post
Share on other sites

Hi Nate,

 

I installed your contribute but I'm not sure how to make the thumbnails resize proportionately. I was able to make an intermediate-sized image for the product info page by adding a "multiplier" to the SMALL_IMAGE_WIDTH & SMALL_IMAGE_HEIGHT values in product_info.php, so I know the contribute is working correctly. I just don't know what I'm supposed to edit to make my thumbnails resize proportionately.

 

Thanks,

Paul

Share this post


Link to post
Share on other sites
I tried all the solutions suggested so far in this thread and I still get this error:

Hi, you seem to have pasted in the code wrong... Check where the error tells you and fix it (maybe you left a stray bracket in there), or try starting with a fresh html_output.php.

I just don't know what I'm supposed to edit to make my thumbnails resize proportionately.

The mod already includes code that will keep the correct ratio of your images when shrunken to thumbnail or "intermediate" size. There is nothing you need to do except set the (in the case of this mod) max thumbnail width and height - which you can keep the same (100x100) so the thumbnails with be max 100 width or max 100 height.


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

Share this post


Link to post
Share on other sites

Thanks for the mod Nate.

Can you explain how to add a larger pic for the product info page.

Do you create a larger image or just stretch the thumbnail. If you create a larger image, where do you put it? Once again, thanks for the great mod. B)

Share this post


Link to post
Share on other sites
Can you explain how to add a larger pic for the product info page.

Do you create a larger image or just stretch the thumbnail. If you create a larger image, where do you put it?

Check out the contrib page at osCommerce... Nothing is being added or "stretched", only the one, large product pic is being scaled to an intermediate or thumbnail sized pic...


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

Share this post


Link to post
Share on other sites

Hi Nate,

 

When you say max thumbnail width and max thumbnail height, are you referring to the values in the Configuration / Images section labeled "Small Image Width" and "Small Image Height"? I have both of these set to 100 but the thumbnail still looks out of proportion. Any ideas?

 

Thanks,

Paul

Share this post


Link to post
Share on other sites

Is the thumbnail either 100px high or 100px wide? If so, then it's the original picture that's out of proportion.


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

Share this post


Link to post
Share on other sites

Hi Nate,

 

The thumbnails are showing the dimensions of 100 x 100 pixels. When I view the product description the image has dimensions of 200 x 200 pixels (multiplier values working correctly), and when I click that image to enlarge, it displays the true image size of 231 x 330 pixels, which has the correct proportions. Is there anything else I can check?

 

Thanks,

Paul

Share this post


Link to post
Share on other sites

If you installed the contrib correctly, the thumbnails will *not* be the same width and height. I'd say take another crack at installing it...


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

Share this post


Link to post
Share on other sites

Hi Nate,

 

I reinstalled but still having the same problem. Here is a copy of my catalog/includes/functions/html_output.php. Can you take a look and see if everything looks ok here?

 

<?php

/*

$Id: html_output.php,v 1.3.2.5 2003/12/17 12:22:51 serg Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

////

// The HTML href link wrapper function

function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {

global $request_type, $session_started, $SID;

 

if (!tep_not_null($page)) {

die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>');

}

 

if ($connection == 'NONSSL') {

$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;

} elseif ($connection == 'SSL') {

if (ENABLE_SSL == true) {

$link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;

} else {

$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;

}

} else {

die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');

}

 

if (tep_not_null($parameters)) {

$link .= $page . '?' . tep_output_string($parameters);

$separator = '&';

} else {

$link .= $page;

$separator = '?';

}

 

while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

 

// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined

if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {

if (tep_not_null($SID)) {

$_sid = $SID;

} elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {

if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {

$_sid = tep_session_name() . '=' . tep_session_id();

}

}

}

 

if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {

while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);

 

$link = str_replace('?', '/', $link);

$link = str_replace('&', '/', $link);

$link = str_replace('=', '/', $link);

 

$separator = '?';

}

 

if (isset($_sid)) {

$link .= $separator . $_sid;

}

 

return $link;

}

 

////

// Modified tep_image function to keep proper ratio and use GD Library (in conjunction

// with product_thumb.php for image resizing. Requires PHP GD Image Library version 2+

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

 

if (($src == '' || $src == 'images/') && IMAGE_REQUIRED == 'false') {

return;

}

 

$image = '<img src="' . $src . '" border="0" alt=" ' . htmlspecialchars(StripSlashes($alt)) . ' " title=" ' . htmlspecialchars(StripSlashes($alt)) . ' "';

 

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

$dont_calculate = 1;

}

 

if (CONFIG_CALCULATE_IMAGE_SIZE && (!$width || !$height) && !$dont_calculate) {

 

if ($image_size = @getimagesize($src)) {

 

if (!$width && $height) {

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

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

} elseif ($width && !$height) {

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

$height = $image_size[1] * $ratio;

} elseif (!$width && !$height) {

$width = $image_size[0];

$height = $image_size[1];

}

} elseif (IMAGE_REQUIRED == 'false') {

 

return '';

}

}

 

if (CONFIG_CALCULATE_IMAGE_SIZE && !$dont_calculate) {

 

if ($image_size = @getimagesize($src)) {

 

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

 

$orig_width = $image_size[1];

$orig_height = $image_size[0];

 

// do we need scaling

if ($image_size[0] > $width || $image_size[1] > $height) {

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

$ry = $image_size[1] / $height;

 

if ($rx < $ry) {

$width = $height / $ratio;

} else {

$height = $width * $ratio;

}

 

// Generate thumbnail on the fly

$image = '<img src="product_thumb.php?img='.$src.'&w='.intval($width).'&h='.intval($height).'" border="0" alt=" ' . htmlspecialchars(StripSlashes($alt)) . ' " title=" ' . htmlspecialchars(StripSlashes($alt)) . ' "';

 

}

}

}

 

if (!$dont_calculate) {

$width = intval($width);

$height = intval($height);

}

 

if ($width && $height) {

$image .= ' width="' . $width . '" height="' . $height . '"';

}

 

if ($params != '') {

$image .= ' ' . $params;

}

 

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

}

 

////

// Output a function button in the selected language

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

global $language;

 

return tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image, $alt, '', '', $parameters);

}

 

////

// Output a separator either through whitespace, or with an image

function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {

return tep_image(DIR_WS_IMAGES . $image, '', $width, $height);

}

 

////

// Output a form

function tep_draw_form($name, $action, $method = 'post', $parameters = '') {

$form = '<form name="' . tep_output_string($name) . '" action="' . tep_output_string($action) . '" method="' . tep_output_string($method) . '"';

 

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

 

$form .= '>';

 

return $form;

}

 

////

// Output a form input field

function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) {

$field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

 

if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {

$field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"';

} elseif (tep_not_null($value)) {

$field .= ' value="' . tep_output_string($value) . '"';

}

 

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

 

$field .= '>';

 

return $field;

}

 

////

// Output a form password field

function tep_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {

return tep_draw_input_field($name, $value, $parameters, 'password', false);

}

 

////

// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()

function tep_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {

$selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

 

if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';

 

if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {

$selection .= ' CHECKED';

}

 

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

 

$selection .= '>';

 

return $selection;

}

 

////

// Output a form checkbox field

function tep_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {

return tep_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);

}

 

////

// Output a form radio field

function tep_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {

return tep_draw_selection_field($name, 'radio', $value, $checked, $parameters);

}

 

////

// Output a form textarea field

function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {

$field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

 

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

 

$field .= '>';

 

if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {

$field .= stripslashes($GLOBALS[$name]);

} elseif (tep_not_null($text)) {

$field .= $text;

}

 

$field .= '</textarea>';

 

return $field;

}

 

////

// Output a form hidden field

function tep_draw_hidden_field($name, $value = '', $parameters = '') {

$field = '<input type="hidden" name="' . tep_output_string($name) . '"';

 

if (tep_not_null($value)) {

$field .= ' value="' . tep_output_string($value) . '"';

} elseif (isset($GLOBALS[$name])) {

$field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"';

}

 

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

 

$field .= '>';

 

return $field;

}

 

////

// Hide form elements

function tep_hide_session_id() {

global $session_started, $SID;

 

if (($session_started == true) && tep_not_null($SID)) {

return tep_draw_hidden_field(tep_session_name(), tep_session_id());

}

}

 

////

// Output a form pull down menu

function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {

$field = '<select name="' . tep_output_string($name) . '"';

 

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

 

$field .= '>';

 

if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

 

for ($i=0, $n=sizeof($values); $i<$n; $i++) {

$field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';

if ($default == $values[$i]['id']) {

$field .= ' SELECTED';

}

 

$field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';

}

$field .= '</select>';

 

if ($required == true) $field .= TEXT_FIELD_REQUIRED;

 

return $field;

}

 

////

// Creates a pull-down list of countries

function tep_get_country_list($name, $selected = '', $parameters = '') {

$countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));

$countries = tep_get_countries();

 

for ($i=0, $n=sizeof($countries); $i<$n; $i++) {

$countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);

}

 

return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters);

}

?>

Share this post


Link to post
Share on other sites

hello there...

 

i get an error after i followed the instructions:

 

Parse error: parse error, unexpected '}' in /home/nmcchi3/public_html/shop/includes/functions/html_output.php on line 187

 

what it means i don't know b/c i did copy everything into the html_output.php as specified in the readme. my file looks exactly like the file posted before me.

 

any ideas what may be the culprit?

 

thank you for your patience.

 

adieu,

macie

Share this post


Link to post
Share on other sites

Paulie, you probably want to turn on "calculate image size" in your osc config...

 

rankinworks, you likely pasted it in wrong... give it another shot.


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

Share this post


Link to post
Share on other sites

Thanks Nate...

 

It finally worked...and what happened was that I forgot to delete the second 'tep_image' function right after it.

 

I have a quick question though...how would i change the background color of the pop enlarge picture when the thumbnail is clicked?

 

Thank you so much for this contribution...It's the best one by far!!!

Share this post


Link to post
Share on other sites

nevermind...i figured it out.

 

one must go to the popup_image.php file and add a css file to it.

very simple but i didn't know at first.

 

now i will try how to do the intermediate size for thumbnails.

 

thanks again.

 

bye,

macie

Share this post


Link to post
Share on other sites

Hi ilan,

 

You replace the tep_image function, as described in the readme... the lines of code you listed above is *not* the whole function... The function continues on down (ending in a closing bracket "}" till you get to the tep_image_submit function.


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

Share this post


Link to post
Share on other sites

hi nate or anyone else who can assist me.

 

when i changed the max/min small image sizes in the online admin to 100x100 instead of 100x80 (the default), the images became distorted like what paulie said happened to him.

 

i also used the intermediate *2 size for the product info page and it worked well except for the distortion.

 

what should i put int he online max/min small image sizes option? so it is proportioned?

 

thank you...

 

macie.

Share this post


Link to post
Share on other sites

i think that my situation is similar to PAULIE'S NOW...

 

i have done what you advised him to do when his thumbnails were not proportioned properly:

 

Paulie, you probably want to turn on "calculate image size" in your osc config...

 

here is my site:

 

http://newmexicanconnection.com/shop

(if you go here, you can see the hatch cookbook that i put in that is suppose to resize http://newmexicanconnection.com/shop/index...9ae4d7dfe90bfc)

 

same thing happend. my thumbnail is seen as 100x100 pix because i put the small image width and height at 100 in the ADMIN configuration online. i did read in the development center to eliminate the width for all the images options as well but i didn't do that...i left the default on.

 

now, the intermediate is 200x200 pix and the original picture is at the right size...not 300x300 like you would think but is 440x312 pix

 

i placed the product_thumb.php file in *catalog's root directory per the readme file:

 

website/shop/product_thumb.php

 

and changed my:

 

website/shop/includes/functions/html_output.php

 

with the following revision:

 

////

// The HTML href link wrapper function

  function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {

    global $request_type, $session_started, $SID;

 

    if (!tep_not_null($page)) {

      die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>');

    }

 

    if ($connection == 'NONSSL') {

      $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;

    } elseif ($connection == 'SSL') {

      if (ENABLE_SSL == true) {

        $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;

      } else {

        $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;

      }

    } else {

      die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');

    }

 

    if (tep_not_null($parameters)) {

      $link .= $page . '?' . tep_output_string($parameters);

      $separator = '&';

    } else {

      $link .= $page;

      $separator = '?';

    }

 

    while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

 

// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined

    if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {

      if (tep_not_null($SID)) {

        $_sid = $SID;

      } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {

        if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {

          $_sid = tep_session_name() . '=' . tep_session_id();

        }

      }

    }

 

    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {

      while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);

 

      $link = str_replace('?', '/', $link);

      $link = str_replace('&', '/', $link);

      $link = str_replace('=', '/', $link);

 

      $separator = '?';

    }

 

    if (isset($_sid)) {

      $link .= $separator . $_sid;

    }

 

    return $link;

  }

 

// Modified tep_image function to keep proper ratio and use GD Library (in conjunction

// with product_thumb.php for image resizing. Requires PHP GD Image Library version 2+

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

 

    if (($src == '' || $src == 'images/') && IMAGE_REQUIRED == 'false') {

        return;

    }

 

    $image = '<img src="' . $src . '" border="0" alt=" ' . htmlspecialchars(StripSlashes($alt)) . '  " title=" ' . htmlspecialchars(StripSlashes($alt)) . ' "';

 

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

        $dont_calculate = 1;

    }

 

    if (CONFIG_CALCULATE_IMAGE_SIZE && (!$width || !$height) && !$dont_calculate) {

 

        if ($image_size = @getimagesize($src)) {

 

            if (!$width && $height) {

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

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

            } elseif ($width && !$height) {

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

                $height = $image_size[1] * $ratio;

            } elseif (!$width && !$height) {

                $width = $image_size[0];

                $height = $image_size[1];

            }

        } elseif (IMAGE_REQUIRED == 'false') {

 

        return '';

        }

    }

 

    if (CONFIG_CALCULATE_IMAGE_SIZE && !$dont_calculate) {

 

        if ($image_size = @getimagesize($src)) {

 

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

     

      $orig_width = $image_size[1];

      $orig_height = $image_size[0];

 

            // do we need scaling

            if ($image_size[0] > $width || $image_size[1] > $height) {

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

                $ry = $image_size[1] / $height;

 

                if ($rx < $ry) {

                    $width = $height / $ratio;

                } else {

                    $height = $width * $ratio;

                }

                       

                // Generate thumbnail on the fly

        $image = '<img src="product_thumb.php?img='.$src.'&w='.intval($width).'&h='.intval($height).'" border="0" alt=" ' . htmlspecialchars(StripSlashes($alt)) . ' " title=" ' . htmlspecialchars(StripSlashes($alt)) . ' "';

       

            }

        }

    }

 

  if (!$dont_calculate) {

    $width = intval($width);

    $height = intval($height);   

  }

 

    if ($width && $height) {

        $image .= ' width="' . $width . '" height="' . $height . '"';

    }

 

    if ($params != '') {

        $image .= ' ' . $params;

    }

 

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

  }

 

////

// Output a function button in the selected language

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

    global $language;

 

    return tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image, $alt, '', '', $parameters);

  }

 

////

// Output a separator either through whitespace, or with an image

  function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {

    return tep_image(DIR_WS_IMAGES . $image, '', $width, $height);

  }

 

////

// Output a form

  function tep_draw_form($name, $action, $method = 'post', $parameters = '') {

    $form = '<form name="' . tep_output_string($name) . '" action="' . tep_output_string($action) . '" method="' . tep_output_string($method) . '"';

 

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

 

    $form .= '>';

 

    return $form;

  }

 

////

// Output a form input field

  function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) {

    $field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

 

    if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {

      $field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"';

    } elseif (tep_not_null($value)) {

      $field .= ' value="' . tep_output_string($value) . '"';

    }

 

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

 

    $field .= '>';

 

    return $field;

  }

 

////

// Output a form password field

  function tep_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {

    return tep_draw_input_field($name, $value, $parameters, 'password', false);

  }

 

////

// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()

  function tep_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {

    $selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

 

    if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';

 

    if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {

      $selection .= ' CHECKED';

    }

 

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

 

    $selection .= '>';

 

    return $selection;

  }

 

////

// Output a form checkbox field

  function tep_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {

    return tep_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);

  }

 

////

// Output a form radio field

  function tep_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {

    return tep_draw_selection_field($name, 'radio', $value, $checked, $parameters);

  }

 

////

// Output a form textarea field

  function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {

    $field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

 

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

 

    $field .= '>';

 

    if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {

      $field .= stripslashes($GLOBALS[$name]);

    } elseif (tep_not_null($text)) {

      $field .= $text;

    }

 

    $field .= '</textarea>';

 

    return $field;

  }

 

////

// Output a form hidden field

  function tep_draw_hidden_field($name, $value = '', $parameters = '') {

    $field = '<input type="hidden" name="' . tep_output_string($name) . '"';

 

    if (tep_not_null($value)) {

      $field .= ' value="' . tep_output_string($value) . '"';

    } elseif (isset($GLOBALS[$name])) {

      $field .= ' value="' . tep_output_string(stripslashes($GLOBALS[$name])) . '"';

    }

 

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

 

    $field .= '>';

 

    return $field;

  }

 

////

// Hide form elements

  function tep_hide_session_id() {

    global $session_started, $SID;

 

    if (($session_started == true) && tep_not_null($SID)) {

      return tep_draw_hidden_field(tep_session_name(), tep_session_id());

    }

  }

 

////

// Output a form pull down menu

  function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {

    $field = '<select name="' . tep_output_string($name) . '"';

 

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

 

    $field .= '>';

 

    if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

 

    for ($i=0, $n=sizeof($values); $i<$n; $i++) {

      $field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';

      if ($default == $values[$i]['id']) {

        $field .= ' SELECTED';

      }

 

      $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';

    }

    $field .= '</select>';

 

    if ($required == true) $field .= TEXT_FIELD_REQUIRED;

 

    return $field;

  }

 

////

// Creates a pull-down list of countries

  function tep_get_country_list($name, $selected = '', $parameters = '') {

    $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));

    $countries = tep_get_countries();

 

    for ($i=0, $n=sizeof($countries); $i<$n; $i++) {

      $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);

    }

 

    return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters);

  }

?>

 

 

**************************

 

So do you have any idea what is going on? I know I have the current GD software loaded on my hosting server because I tested it on the oscommerce administration online tools entitled: server info

 

I really would like to get your contribution working on my site.

 

if anyone else has experienced the same problem and found a way to fix it or someone who used it and got it to work right off the bat...please help me. i know nate is probably a busy guy, and i appreciate all the time and effort you put in helping us.

 

thanks,

macie

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

×