Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Support thread for the Image Magic contribution


tomjmul

Recommended Posts

Tom,

I am interested in your "guaranteed install" service but I do have a question as to how this contribution might interact (or not) with a modification I have made to my images on the product_info pages. I eliminated the pop up window that shows up when a product is clicked on for a larger image and instead installed a contribution that allows the picture to be resized and displayed on the page bigger and smaller when it is clicked on (again rather than having a popup). Check out my website: www.momentsofelegance.com. I would still like to have this functionality rather than the pop up windows on the images. I have already installed the contribution except for the html_output page which is giving me some trouble and I think may need some slight modifications to your code in order to make this work. check out my site (to see what I mean as far as how the images are set up) and I've also pasted below my tep_image function for you to see what changes were made. Please let me know if you think you'd be able to get this contribution to work without using the popu ups and I can go ahead an place the install order on your website.

 

Thanks!!!

 

 

OK, done the install and image magic is now working fine. The javascript-based image amplifier can only work when the full-sized image has been served, which is of course incompatible with any thumbnailer.

Edited by tomjmul

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

  • Replies 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

Just found a small bug which can result in stock osc button images or arrows etc showing up as broken images if they have been deleted.

 

The change is to tep_image() in html_output.php

 

Find:

 

} elseif (IMAGE_REQUIRED == 'false') {

return '';

}

 

Change to:

 

} elseif (IMAGE_REQUIRED == 'false') {

return false;

}

 

Tom

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Having read the contrib and a few posts on this thread, im still unable to find out if this contrib adds extra images for each product?

 

If not anyone know the best contrib for this.

 

Thanks

Link to comment
Share on other sites

Hello there and thanks for a great contrib!

Here is the deal. I went through the forum, installed by the step-by-step guide from your site and still having problems. I've got the thumbnails dir created with images inside, img url looks good with imagemagic part in it. But.. none of the images display. when I copy and paste the IMG url it shows me an error: "Warning: chdir(): No such file or directory (errno 2) in /hsphere/local/home/kirkulik/vikomfurniture.com/catalog/imagemagic.php on line 21" and them some header errors. I'm stuck here... Any ideas how to fix that? Here is the link to the page I'm working on: http://vikomfurniture.com/catalog/

Thanks a lot!

Link to comment
Share on other sites

Hi just attempted to install this contribution and when i access my admin panel i am presented with the following:

 

Fatal error: Call to undefined function tep_draw_separator() in /catalog/admin/configuration.php on line 62

 

Can anyone please explain this to me?

 

Many Thanks

D4

Link to comment
Share on other sites

Hello there and thanks for a great contrib!

Here is the deal. I went through the forum, installed by the step-by-step guide from your site and still having problems. I've got the thumbnails dir created with images inside, img url looks good with imagemagic part in it. But.. none of the images display. when I copy and paste the IMG url it shows me an error: "Warning: chdir(): No such file or directory (errno 2) in /hsphere/local/home/kirkulik/vikomfurniture.com/catalog/imagemagic.php on line 21" and them some header errors. I'm stuck here... Any ideas how to fix that? Here is the link to the page I'm working on: http://vikomfurniture.com/catalog/

Thanks a lot!

 

Whoo-hoo! I got it. I commented line 21 in imagemagic.php and it it rocks...

Link to comment
Share on other sites

Hi there,

 

If anybody has managed to get the Watermarking working on a Windows server then please could you let me know how?! The broken image error was solved by removing the ampersands from various places, but the watermarking just doesn't work. Thumbnailing works fine though!

 

Any ideas anybody?

 

Cheers.

Link to comment
Share on other sites

hi all,

 

my watermarking is not working. in admin configuration->image magic->text watermark font name i can't select any font because there's nothing showing up in the dropdown menu. It says "New TTF fonts may be installed in your: /catalog/includes/imagemagic/fonts/ directory" there. In my ftp its /html/includes/imagemagic/fonts/ and 4 fonts are in there. Whats wrong ? Why can't i select a font?

 

Thanks

Edited by Turbo
Link to comment
Share on other sites

I spent about an hour trying to figure it out, but i finally got it to work.

 

If your product images were displaying correctly before you over wrote the tep_image() function, try this.

 

Right click on one of your product image and select "properties"

 

copy paste the address or url that looks something like this into your browser:

 

http://www.yourdomain.com/imagemagic.php?i...;h=85&page=

 

You will get a bunch of errors.

 

In the first line or the first few lines, if you see a permissions error, simply create a directory called "thumbnails" under catalog (catalog/thumbnails/) based on whether you have a catalog directory or not. If you don't have a catalog directory, create the "thumbnails" folder under public_html

 

Assign the "thumbnails" directory 777 permission. Go to your website and refresh your products page.

Hopefully, your images will start to show.

 

I hope this helps someone.

 

Ahmed

Link to comment
Share on other sites

got it to work!

browsed this thread and found something, you have to change the document root in configure.php,

don't really know what i've done but it works :P

 

only thing thats still not working is : Resize Watermark Image

when i put it on true the images are not shown anymore.....

 

any solutions?? - thanks

Link to comment
Share on other sites

Hi

 

I beleive i have installed the contrib correctly but when i turn imagemagic on i lose all my images and get "error database connection" in its place i have read through the thread (it is quite long!) but can't seem to find an answer all though i have seen the question before

 

www.phoenix-games.co.uk

 

 

Cheers

 

Chris

Link to comment
Share on other sites

I would like to install this contribution and test it on my laptop before uploading to my server, but I can't get past the stumbling block of activating the gd image library! :'( I have uncommented the line "extention=php_gd2.dll" in my php.ini file, but I can't see anything when I look under server info in the admin section.

 

I am running Apache 1.3.33, PHP 4.4.1, MySQL 5.0.21 standard, & phpMyAdmin 2.8.0.3 on Mac OSX (10.4.6).

Any advice as to what I am doing wrong (or NOT doing, for that matter)?

 

My site is currently on a test server: http://victor.ysfa.com/catalog. Thanx in advance!

Link to comment
Share on other sites

Maybe I'm a little daff, but why in the SQL file is there a specific configuration_id ? Shouldn't that be auto-incremented?

 

Well that's the beauty of open source. You have the source code to change anything you don't like

 

vmtent, can't think what the problem is. Are you sure you actually have the gd2.dll file on your system.

Also, I have come across problems where there are multiple php.ini files floating around and the wrong one edited (it's a longshot)

 

Tom

OSC Image Magic

On-the-fly thumbnails, watermarks and image processing

Link to comment
Share on other sites

Hi,

I love this contibution. My Pics will look great now. I am have one problem. The product information thumbnail is not being created. I see that the small thum and the popup are being created in the thumbnail folder but not the product info pic. I do have the setting on the product information image width at 200 and the hieght at 0. Please help.

Link to comment
Share on other sites

vmtent, can't think what the problem is. Are you sure you actually have the gd2.dll file on your system.

 

Tom

 

Tom,

 

I honestly don't know. I know that makes me sound like a total muppet, but I am stumped! I installed PHP 4.4.1, and from everything I've read (if I understand correctly), then the gd image library is supposed to be bundled with PHP after v4.3, right? If I have it, how do I find it & activate it? Another related question: can I install the IM contrib without activating the GD library on my laptop if the server that hosts my website already has it installed? I know I wouldn't see functionality locally, but would everything work once I uploaded to the server? All I am looking for is quicker page loads so I don't lose customer interest due to slow page loading.

Link to comment
Share on other sites

OK, I just downloaded the gd-2.0.33.tar file, but I don't know how to install it. :'( I'd rather use the bundled one if it is there already with my PHP 4.4.1.

 

I've had success with all my other contrib additions, but this one is really making me scratch my head. :'(

Any & all help is appreciated!

Link to comment
Share on other sites

Installing the contrib wasn't the problem, I've done that. Had I not done anything, I would not hesitate paying for the installation service at all. I will still make a donation when all is said & done.

 

My problem is loading the gd image library that is/was supposed to be included with the PHP bundle!

 

Oh, & speaking of too hot, I'm in Phoenix, AZ, where it's been 115?F (that's 46.1?C). You Brits would be moaning! B)

Edited by vmtent
Link to comment
Share on other sites

Spent allllll day trying to get this contribution to work and finally get it done.

I`m posting back as a reference to those having my same problem.After my install images wheren`t loading and reason why was because in the readme install just says :

 

replace the entire tep_image() function with

 

But doesn`t clearly point what is exactly to be done .

Next is the original html_output.php :

 

<?php

/*

$Id: html_output.php,v 1.56 2003/07/09 01:15:48 hpdl 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;

}

 

////

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

}

 

////

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

}

?>

 

 

What shows in RED is what i had to change with This :

 

// BOF Image Magic

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

global $product_info;

 

//Allow for a new intermediate sized thumbnail size to be set

//without any changes having to be made to the product_info page itself.

//(see the lengths I go to to make your life easier :-)

if (strstr($_SERVER['PHP_SELF'],"product_info.php")) {

 

if (isset($product_info['products_image'])

&& $src == DIR_WS_IMAGES . $product_info['products_image']

&& $product_info[products_id]==$_GET['products_id']) { //final check just to make sure that we don't interfere with other contribs

$width = PRODUCT_INFO_IMAGE_WIDTH == 0?'':PRODUCT_INFO_IMAGE_WIDTH;

$height = PRODUCT_INFO_IMAGE_HEIGHT == 0?'':PRODUCT_INFO_IMAGE_HEIGHT;

$product_info_image=true;

$page="prod_info";

}

}

 

//Detect whether this is a pop-up image

if (strstr($_SERVER['PHP_SELF'],"popup_image.php")) $page="popup";

 

//do we apply the IE PNG alpha transparency fix?

if (strstr(strtolower($src),".png") && CFG_PNG_BUG=="True") $fix_png = true;

 

//send the image for processing unless told otherwise

$image = '<img src="' . $src . '"'; //set up the image tag just in case we don't want to process

if (CFG_MASTER_SWITCH=="On") $calculate = true;

else $calculate=false;

 

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

if (strstr($width,'%') == true || strstr($height,'%') == true) $calculate = false;

 

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

if (strstr($image, 'pixel')) $calculate = false;

 

 

$image_size = @getimagesize($src);

 

 

// Decide whether or not we want to process this image

if (($width == '' && $height == '' && $page != 'popup' ) || ($width == $image_size[0] && $height == $image_size[0] && $page != 'popup')) {

if (CFG_PROCESS_GRAPHICS=="False") $calculate = false; //looks like this is a store graphic rather than product image

}

 

// Is this image good to go?

if (CONFIG_CALCULATE_IMAGE_SIZE && $calculate) {

 

if ($image_size) {

 

$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 && !$over_ride) {

$width = $image_size[0];

$height = $image_size[1];

}

 

//Encrypt the image filename if switched on

if (CFG_ENCRYPT_FILENAMES == "True" && CFG_ENCRYPTION_KEY !="") {

$result = '';

$key=CFG_ENCRYPTION_KEY;

for($i=0; $i<strlen($src); $i++) {

$char = substr($src, $i, 1);

$keychar = substr($key, ($i % strlen($key))-1, 1);

$char = chr(ord($char)+ord($keychar));

$result.=$char;

}

$src=urlencode(base64_encode($result));

}

 

//Return the html

$image = '<img src="imagemagic.php?img='.$src.'&w='.

tep_output_string($width).'&h='.tep_output_string($height).'&page='.$page.'"';

 

} elseif (IMAGE_REQUIRED == 'false') {

return false;

}

}

 

//If the size asked for is greater than the image itself, we check the configs to see if this is allowed and if not over-ride

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

if (CFG_ALLOW_LARGER != 'True'){

$width=$image_size[0];

$height=$image_size[1];

$over_ride = true;

}

}

// 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) . '"';

}

 

if ($fix_png && CFG_MASTER_SWITCH=="On") {

$image .= ' onload="fixPNG(this)"';

}

 

$image .= '>';

return $image;

}

//EOF Image Magic

Link to comment
Share on other sites

Spent allllll day trying to get this contribution to work and finally get it done.

I`m posting back as a reference to those having my same problem.After my install images wheren`t loading and reason why was because in the readme install just says :

 

replace the entire tep_image() function with

 

But doesn`t clearly point what is exactly to be done .

Next is the original html_output.php :

 

<?php

/*

$Id: html_output.php,v 1.56 2003/07/09 01:15:48 hpdl 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;

}

 

////

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

}

 

////

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

}

?>

What shows in RED is what i had to change with This :

 

// BOF Image Magic

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

global $product_info;

 

//Allow for a new intermediate sized thumbnail size to be set

//without any changes having to be made to the product_info page itself.

//(see the lengths I go to to make your life easier :-)

if (strstr($_SERVER['PHP_SELF'],"product_info.php")) {

 

if (isset($product_info['products_image'])

&& $src == DIR_WS_IMAGES . $product_info['products_image']

&& $product_info[products_id]==$_GET['products_id']) { //final check just to make sure that we don't interfere with other contribs

$width = PRODUCT_INFO_IMAGE_WIDTH == 0?'':PRODUCT_INFO_IMAGE_WIDTH;

$height = PRODUCT_INFO_IMAGE_HEIGHT == 0?'':PRODUCT_INFO_IMAGE_HEIGHT;

$product_info_image=true;

$page="prod_info";

}

}

 

//Detect whether this is a pop-up image

if (strstr($_SERVER['PHP_SELF'],"popup_image.php")) $page="popup";

 

//do we apply the IE PNG alpha transparency fix?

if (strstr(strtolower($src),".png") && CFG_PNG_BUG=="True") $fix_png = true;

 

//send the image for processing unless told otherwise

$image = '<img src="' . $src . '"'; //set up the image tag just in case we don't want to process

if (CFG_MASTER_SWITCH=="On") $calculate = true;

else $calculate=false;

 

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

if (strstr($width,'%') == true || strstr($height,'%') == true) $calculate = false;

 

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

if (strstr($image, 'pixel')) $calculate = false;

$image_size = @getimagesize($src);

// Decide whether or not we want to process this image

if (($width == '' && $height == '' && $page != 'popup' ) || ($width == $image_size[0] && $height == $image_size[0] && $page != 'popup')) {

if (CFG_PROCESS_GRAPHICS=="False") $calculate = false; //looks like this is a store graphic rather than product image

}

 

// Is this image good to go?

if (CONFIG_CALCULATE_IMAGE_SIZE && $calculate) {

 

if ($image_size) {

 

$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 && !$over_ride) {

$width = $image_size[0];

$height = $image_size[1];

}

 

//Encrypt the image filename if switched on

if (CFG_ENCRYPT_FILENAMES == "True" && CFG_ENCRYPTION_KEY !="") {

$result = '';

$key=CFG_ENCRYPTION_KEY;

for($i=0; $i<strlen($src); $i++) {

$char = substr($src, $i, 1);

$keychar = substr($key, ($i % strlen($key))-1, 1);

$char = chr(ord($char)+ord($keychar));

$result.=$char;

}

$src=urlencode(base64_encode($result));

}

 

//Return the html

$image = '<img src="imagemagic.php?img='.$src.'&w='.

tep_output_string($width).'&h='.tep_output_string($height).'&page='.$page.'"';

 

} elseif (IMAGE_REQUIRED == 'false') {

return false;

}

}

 

//If the size asked for is greater than the image itself, we check the configs to see if this is allowed and if not over-ride

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

if (CFG_ALLOW_LARGER != 'True'){

$width=$image_size[0];

$height=$image_size[1];

$over_ride = true;

}

}

// 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) . '"';

}

 

if ($fix_png && CFG_MASTER_SWITCH=="On") {

$image .= ' onload="fixPNG(this)"';

}

 

$image .= '>';

return $image;

}

//EOF Image Magic

 

 

 

I think this fix may help me too but I do not see anything in red.

Which lines do I change?

Link to comment
Share on other sites

Spent allllll day trying to get this contribution to work and finally get it done.

I`m posting back as a reference to those having my same problem.After my install images wheren`t loading and reason why was because in the readme install just says :

 

 

Replace the entire tep_image() function with

 

 

But doesn`t clearly point what is exactly to be done .

Next is the original html_output.php :

 

<?php

/*

$Id: html_output.php,v 1.56 2003/07/09 01:15:48 hpdl 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;

}

 

////

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

}

 

////

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

}

?>

 

 

-----------------------------------------------------------------

 

 

 

What shows in RED is what i had to change with This :

 

 

// BOF Image Magic

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

global $product_info;

 

//Allow for a new intermediate sized thumbnail size to be set

//without any changes having to be made to the product_info page itself.

//(see the lengths I go to to make your life easier :-)

if (strstr($_SERVER['PHP_SELF'],"product_info.php")) {

 

if (isset($product_info['products_image'])

&& $src == DIR_WS_IMAGES . $product_info['products_image']

&& $product_info[products_id]==$_GET['products_id']) { //final check just to make sure that we don't interfere with other contribs

$width = PRODUCT_INFO_IMAGE_WIDTH == 0?'':PRODUCT_INFO_IMAGE_WIDTH;

$height = PRODUCT_INFO_IMAGE_HEIGHT == 0?'':PRODUCT_INFO_IMAGE_HEIGHT;

$product_info_image=true;

$page="prod_info";

}

}

 

//Detect whether this is a pop-up image

if (strstr($_SERVER['PHP_SELF'],"popup_image.php")) $page="popup";

 

//do we apply the IE PNG alpha transparency fix?

if (strstr(strtolower($src),".png") && CFG_PNG_BUG=="True") $fix_png = true;

 

//send the image for processing unless told otherwise

$image = '<img src="' . $src . '"'; //set up the image tag just in case we don't want to process

if (CFG_MASTER_SWITCH=="On") $calculate = true;

else $calculate=false;

 

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

if (strstr($width,'%') == true || strstr($height,'%') == true) $calculate = false;

 

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

if (strstr($image, 'pixel')) $calculate = false;

 

 

$image_size = @getimagesize($src);

 

 

// Decide whether or not we want to process this image

if (($width == '' && $height == '' && $page != 'popup' ) || ($width == $image_size[0] && $height == $image_size[0] && $page != 'popup')) {

if (CFG_PROCESS_GRAPHICS=="False") $calculate = false; //looks like this is a store graphic rather than product image

}

 

// Is this image good to go?

if (CONFIG_CALCULATE_IMAGE_SIZE && $calculate) {

 

if ($image_size) {

 

$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 && !$over_ride) {

$width = $image_size[0];

$height = $image_size[1];

}

 

//Encrypt the image filename if switched on

if (CFG_ENCRYPT_FILENAMES == "True" && CFG_ENCRYPTION_KEY !="") {

$result = '';

$key=CFG_ENCRYPTION_KEY;

for($i=0; $i<strlen($src); $i++) {

$char = substr($src, $i, 1);

$keychar = substr($key, ($i % strlen($key))-1, 1);

$char = chr(ord($char)+ord($keychar));

$result.=$char;

}

$src=urlencode(base64_encode($result));

}

 

//Return the html

$image = '<img src="imagemagic.php?img='.$src.'&w='.

tep_output_string($width).'&h='.tep_output_string($height).'&page='.$page.'"';

 

} elseif (IMAGE_REQUIRED == 'false') {

return false;

}

}

 

//If the size asked for is greater than the image itself, we check the configs to see if this is allowed and if not over-ride

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

if (CFG_ALLOW_LARGER != 'True'){

$width=$image_size[0];

$height=$image_size[1];

$over_ride = true;

}

}

// 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) . '"';

}

 

if ($fix_png && CFG_MASTER_SWITCH=="On") {

$image .= ' onload="fixPNG(this)"';

}

 

$image .= '>';

return $image;

}

//EOF Image Magic

Link to comment
Share on other sites

Can someone give me some help. I have installed it and have no errors but it doesn't seem to be working. All of my images have there original filenames. I followed the instructions as close as possible. :-)

 

PHP Version 4.3.9

Apache/2.0.52

GD Version bundled (2.0.28 compatible)

Mysql 4.1.20

Edited by natewlew

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

Hello, I just installed Image Magic 1.5 on my site and have followed the VERY EASY install directions to the T. I have not done anything with the configuration of the Image Magic in the Admin area yet. I tried my site and came up with the following error:

 

Fatal error: Call to undefined function tep_draw_separator() in /home/everyth5/public_html/includes/classes/boxes.php on line 117

 

Do I HAVE to change the settings in the Admin or is it operational the way it is? I just wanted to see what changes I would have to make first before I started monkeying with the default settings.

 

If not, then what is wrong with the code, is there a DEFINE missing somewhere? I haven't the foggiest idea where to look first.

 

This is my site.

 

This is the code from boxes.php:

 

 

QUOTE

<?php

/*

$Id: boxes.php,v 1.33 2003/06/09 22:22:50 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright ? 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class tableBox {

var $table_border = '0';

var $table_width = '100%';

var $table_cellspacing = '0';

var $table_cellpadding = '2';

var $table_parameters = '';

var $table_row_parameters = '';

var $table_data_parameters = '';

 

// class constructor

function tableBox($contents, $direct_output = false) {

$tableBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';

if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;

$tableBox_string .= '>' . "\n";

 

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

if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";

$tableBox_string .= ' <tr';

if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;

if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];

$tableBox_string .= '>' . "\n";

 

if (isset($contents[$i][0]) && is_array($contents[$i][0])) {

for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {

if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {

$tableBox_string .= ' <td';

if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';

if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {

$tableBox_string .= ' ' . $contents[$i][$x]['params'];

} elseif (tep_not_null($this->table_data_parameters)) {

$tableBox_string .= ' ' . $this->table_data_parameters;

}

$tableBox_string .= '>';

if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];

$tableBox_string .= $contents[$i][$x]['text'];

if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';

$tableBox_string .= '</td>' . "\n";

}

}

} else {

$tableBox_string .= ' <td';

if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';

if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {

$tableBox_string .= ' ' . $contents[$i]['params'];

} elseif (tep_not_null($this->table_data_parameters)) {

$tableBox_string .= ' ' . $this->table_data_parameters;

}

$tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";

}

 

$tableBox_string .= ' </tr>' . "\n";

if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";

}

 

$tableBox_string .= '</table>' . "\n";

 

if ($direct_output == true) echo $tableBox_string;

 

return $tableBox_string;

}

}

 

class infoBox extends tableBox {

function infoBox($contents) {

$info_box_contents = array();

$info_box_contents[] = array('text' => $this->infoBoxContents($contents));

$this->table_cellpadding = '1';

$this->table_parameters = 'class="infoBox"';

$this->tableBox($info_box_contents, true);

}

 

function infoBoxContents($contents) {

$this->table_cellpadding = '3';

$this->table_parameters = 'class="infoBoxContents"';

$info_box_contents = array();

$info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));

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

$info_box_contents[] = array(array('align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),

'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),

'params' => 'class="boxText"',

'text' => (isset($contents[$i]['text']) ? $contents[$i]['text'] : '')));

}

$info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));

return $this->tableBox($info_box_contents);

}

}

 

class infoBoxHeading extends tableBox {

function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {

$this->table_cellpadding = '0';

 

if ($left_corner == true) {

$left_corner = tep_image(DIR_WS_IMAGES . 'infobox/new_orange_corner.gif');

} else {

$left_corner = tep_image(DIR_WS_IMAGES . 'infobox/new_orange_corner.gif');

}

if ($right_arrow == true) {

$right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';

} else {

$right_arrow = '';

}

if ($right_corner == true) {

$right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/new_orange_corner.gif');

} else {

$right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');

}

 

$info_box_contents = array();

$info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"',

'text' => $left_corner),

array('params' => 'width="100%" height="14" class="infoBoxHeading"',

'text' => $contents[0]['text']),

array('params' => 'height="14" class="infoBoxHeading" nowrap',

'text' => $right_corner));

 

$this->tableBox($info_box_contents, true);

}

}

 

class contentBox extends tableBox {

function contentBox($contents) {

$info_box_contents = array();

$info_box_contents[] = array('text' => $this->contentBoxContents($contents));

$this->table_cellpadding = '1';

$this->table_parameters = 'class="infoBox"';

$this->tableBox($info_box_contents, true);

}

 

function contentBoxContents($contents) {

$this->table_cellpadding = '4';

$this->table_parameters = 'class="infoBoxContents"';

return $this->tableBox($contents);

}

}

 

class contentBoxHeading extends tableBox {

function contentBoxHeading($contents) {

$this->table_width = '100%';

$this->table_cellpadding = '0';

 

$info_box_contents = array();

$info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"',

'text' => tep_image(DIR_WS_IMAGES . 'infobox/new_orange_corner.gif')),

array('params' => 'height="14" class="infoBoxHeading" width="100%"',

'text' => $contents[0]['text']),

array('params' => 'height="14" class="infoBoxHeading"',

'text' => tep_image(DIR_WS_IMAGES . 'infobox/new_orange_corner.gif')));

 

$this->tableBox($info_box_contents, true);

}

}

 

class errorBox extends tableBox {

function errorBox($contents) {

$this->table_data_parameters = 'class="errorBox"';

$this->tableBox($contents, true);

}

}

 

class productListingBox extends tableBox {

function productListingBox($contents) {

$this->table_parameters = 'class="productListing"';

$this->tableBox($contents, true);

}

}

?>

 

 

The red code is line 117

thanks in advance for your help.

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