Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Support thread for the Image Magic contribution


tomjmul

Recommended Posts

Hi,

 

I have installed Image Magic, and everything works fine....but, when i try to select (for exampel) "Watermark Image File" and edit i got following error:

 

Fatal error: Call to undefined function: tep_cfg_pull_down_installed_watermarks() in /home/ronnefal/public_html/tqracing-se/admin/configuration.php(125) : eval()'d code on line 1

 

Do anyone have any suggestions ?

 

 

/Pierre

Link to comment
Share on other sites

  • Replies 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

I am sorry to keep asking, but i really cant figure this out...when i first try to install the sql file before installing any of the other documents i get this error....

 

SQL query:

 

INSERT INTO configuration( configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function )

VALUES ( 3205, 'Product Information Image Width', 'PRODUCT_INFO_IMAGE_WIDTH', '101', 'The pixel width of images shown on your product information page', 4, 100, NULL , '2005-01-06 20:24:30', NULL , '' ) ;

 

 

 

MySQL said:

 

#1062 - Duplicate entry '3205' for key 1

 

Notice: Undefined offset: 1 in C:\Server\Apache2\htdocs\phpMyAdmin\libraries\common.lib.php on line 736

 

Notice: Undefined offset: 1 in C:\Server\Apache2\htdocs\phpMyAdmin\libraries\common.lib.php on line 740

 

Notice: Undefined offset: 1 in C:\Server\Apache2\htdocs\phpMyAdmin\libraries\common.lib.php on line 744

 

I obviously cant go any further without figureing out why I cant update the database ...has anyone seen this problem...I really need this contribution

 

Thanks so much....

Link to comment
Share on other sites

Okay guys nevermind...It was my mistake on an import ...apparently I had some local setting configured wrong originally and then it corrputed sql on the database a while back...I have a new question though...

 

I am using the optional related products module on the product page...but now with image magic installed and working...the optional products showing up on the page are the same size as the product picture...and not thumbnails like they should be....any idea how i couild correct this...has anyone tried this?

 

Im really confused...i thought maybe i could rename the "products_image" in the related products module to somethnig else... but i dont know what that would be...when the images are resized in image magic are they saved in the database in a diff way than "products_image"

 

Does anyone have any ideas...I would really appreciate it...

Link to comment
Share on other sites

I'm also at my wit's end trying to install this contribution.

 

This is my third full day at it.

 

When Image Magic is turned on using the master switch no store images display. If I turn "Process Store Graphics" off, I get store images, but all product images are broken.

 

The path in the properties of the broken images is:

 

http://127.0.0.1/vintage/catalog/imagemagi...w=36&h=57&page=

 

I've trawled through this thread from beginning to end.

 

- I turned off thumbnail server caching

- I created a thumbnail folder in every folder I could think of!

- SAFE MODE is OFF

- I uninstalled and reinstalled

- My DIR_FS_CATALOG path in configure.php is correct

 

My store is installed to \vintage\catalog is this a problem?

 

I'd be extremely grateful for any assistance.

 

Many thanks,

 

Di11on

Link to comment
Share on other sites

Finally got it working!!!

 

This was the problem:

 

Have a look for your error reprting line and change to something like this:

 

error_reporting = E_ALL & ~E_NOTICE

 

The results are really great! Just what I was looking for

 

What would be really helpful, would be a troubleshooting checklist at the end of the readme file which could spare people a lot of time trawling through this thread. Might also save you some time Tom :-)

 

A list of things to check like:

 

- Is thumbnail folder created?

- Is SAFE MODE is OFF?

- Is DIR_FS_CATALOG path set correctly in configure.php?

- Is thumbnail server caching turned off?

- Is error reporting turned off in PHP.ini as follows:

error_reporting = E_ALL & ~E_NOTICE

 

Etc.

 

Thanks

 

Jody

Link to comment
Share on other sites

Finally got it working!!!

 

This was the problem:

The results are really great! Just what I was looking for

 

What would be really helpful, would be a troubleshooting checklist at the end of the readme file which could spare people a lot of time trawling through this thread. Might also save you some time Tom :-)

 

A list of things to check like:

 

- Is thumbnail folder created?

- Is SAFE MODE is OFF?

- Is DIR_FS_CATALOG path set correctly in configure.php?

- Is thumbnail server caching turned off?

- Is error reporting turned off in PHP.ini as follows:

error_reporting = E_ALL & ~E_NOTICE

 

Etc.

 

Thanks

 

Jody

 

 

Hello,

 

Thank you for all those details, would you please tell me where you find this error_reporting text ?

 

Thx in advance

Link to comment
Share on other sites

Hi,

 

I have installed Image Magic, and everything works fine....but, when i try to select (for exampel) "Watermark Image File" and edit i got following error:

 

Fatal error: Call to undefined function: tep_cfg_pull_down_installed_watermarks() in /home/ronnefal/public_html/tqracing-se/admin/configuration.php(125) : eval()'d code on line 1

 

Do anyone have any suggestions ?

/Pierre

 

Same problem here. Also get the same error when trying to select a font for text watermarks.

Fatal error: Call to undefined function: tep_cfg_pull_down_installed_fonts() in /homepages/2/d126604748/htdocs/catalog/admin/configuration.php(125) : eval()'d code on line 1

 

and text position...

Fatal error: Call to undefined function: tep_cfg_pull_down_watermark_alignment() in /homepages/2/d126604748/htdocs/catalog/admin/configuration.php(125) : eval()'d code on line 1

 

?????

Link to comment
Share on other sites

The "extra Images" contrib should work fine with Image Magic. I looked at a lot of contribs before installing them and they should not conflict. Anyone that can confirm this?

 

Yes, I just installed Image Magic and then the Extra Images contrib with flying colors. Everything works beautifully. Both are outstanding contribs, exactly what I needed.

Link to comment
Share on other sites

Warning: imagecreatefrompng(): 'images/robe.gif' is not a valid PNG file in /home/admin/kidistyle.com/html/imagemagic.php on line 224

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/admin/kidistyle.com/html/imagemagic.php on line 261

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/kidistyle.com/html/imagemagic.php:224) in /home/admin/kidistyle.com/html/imagemagic.php on line 458

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/kidistyle.com/html/imagemagic.php:224) in /home/admin/kidistyle.com/html/imagemagic.php on line 459

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/kidistyle.com/html/imagemagic.php:224) in /home/admin/kidistyle.com/html/imagemagic.php on line 462

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/kidistyle.com/html/imagemagic.php:224) in /home/admin/kidistyle.com/html/imagemagic.php on line 464

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/kidistyle.com/html/imagemagic.php:224) in /home/admin/kidistyle.com/html/imagemagic.php on line 465

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/kidistyle.com/html/imagemagic.php:224) in /home/admin/kidistyle.com/html/imagemagic.php on line 319
PNG 

safe mode OFF

thumbnail created

DIR_FS_CATALOG path is ok

 

if i upload *.jpg extention everything is ok. all *.gif format images is missing and when i try to view this image i getting such image magic errors.

 

maybe someone can help to resolv such problem.

 

thank you in advance for all help.

Link to comment
Share on other sites

everything is ok now. thank you for nice contribution maybe someone know how this contribution will work with other contribution who add multiple images for item ?

 

maybe someone can offer good contribtion which will work wth this image magic without any errors ?

 

thank you in advance.

Link to comment
Share on other sites

everything is ok now. thank you for nice contribution maybe someone know how this contribution will work with other contribution who add multiple images for item ?

 

maybe someone can offer good contribtion which will work wth this image magic without any errors ?

 

thank you in advance.

 

How did you fix the .gif images not showing up?????

Link to comment
Share on other sites

How did you fix the .gif images not showing up?????

my gd library have not supported *.gif format. so i just updated gd library.

 

maybe you know what multiple images contribution can work with image magic without errors ?

 

thank you.

Link to comment
Share on other sites

Dear Sirs

 

I've installed the Image Magic Contribution, but I'm experiencing a strange situation concerning the & in the image link.

In the html_output.php the problem concerns the line:

 

//Return the html

//$image = '<img src="imagemagic.php?img='.$src.'&w='.tep_output_string($width).'&h='.tep_output_string($height).'&page='.$page.'"';

 

This result in the following code in the html files:

 

<IMG title="Quarto Ambar" height=8 alt="Quarto Ambar" src="imagemagic.php?img=images/grp_bg10162_lg.jpg&w=102&h=1&page=prod_info" width=102 border=0></A>

 

The problem is that the &_GET will be with the wrong values, resulting in a page without any image.

 

How can I force, not to translate & in &?

 

PS: I've also tested with:

$image = '<img src="imagemagic.php?img='.$src.'&'.'w='.tep_output_string($width).'&'.'h='.tep_output_string($height).'&'.'page='.$page.'"';

 

(Above, where is shown & the correct value is & amp ;)

 

 

and

 

$image = '<img src="imagemagic.php?img='.$src."&".'w='.tep_output_string($width)."&".'h='.tep_output_string($height)."&".'page='.$page.'"';

 

(Above, where is shown & the correct value is & amp ;)

 

And the result is the same.

 

Best Regards

Rui Castro

Edited by rcastro
Link to comment
Share on other sites

my gd library have not supported *.gif format. so i just updated gd library.

 

maybe you know what multiple images contribution can work with image magic without errors ?

 

thank you.

 

How do I know if my gd library supports *.gif? I am with a hosting company, not my own server. Unfortunately, I don't know what multiple images contribution will work with image magic.

 

Thanks!!

Link to comment
Share on other sites

Hello,

 

is there any fix i can do so that existing images with spaces in the filenames will show, currently the refuse to appear without renaming and it is causing an issue with the number of images we already have.

 

Any ideas?

 

Cheers

 

Stubbsy

Link to comment
Share on other sites

Hello,

 

i migrated from a server to another.

All the products images disappeared but the webdesign pics are Ok. I noticed that when I switched off my imageMagis, the products displayed correctly. thumbnails dir is chmod 777.

 

Where could be my mistake?

Thanks in advance

Link to comment
Share on other sites

ive uninstalled reinstalled and i cant get it working on this new domain same host just got a new domain name for it

 

My includes/functions/html_output.php file is

 

 

<?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 (c) 2003 osCommerce

 Released under the GNU General Public License
*/

////
// Ultimate SEO URLs v2.1
// The HTML href link wrapper function
 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
global $seo_urls;		
	if ( !is_object($seo_urls) ){
		if ( !class_exists('SEO_URL') ){
			include_once(DIR_WS_CLASSES . 'seo.class.php');
		}
		global $languages_id;
		$seo_urls = new SEO_URL($languages_id);
	}
return $seo_urls->href_link($page, $parameters, $connection, $add_session_id);
 }


////
// The HTML image wrapper function
// 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 ''; 
} 
} 


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


////
// 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 .= tep_output_string_protected(stripslashes($GLOBALS[$name]));
} elseif (tep_not_null($text)) {
  $field .= tep_output_string_protected($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);
 }
////rmh referral
// Creates a pull-down list of sources
 function tep_get_source_list($name, $show_other = false, $selected = '', $parameters = '') {
$sources_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$sources = tep_get_sources();

for ($i=0, $n=sizeof($sources); $i<$n; $i++) {
  $sources_array[] = array('id' => $sources[$i]['sources_id'], 'text' => $sources[$i]['sources_name']);
}

if ($show_other == 'true') {
  $sources_array[] = array('id' => '9999', 'text' => PULL_DOWN_OTHER);
}

return tep_draw_pull_down_menu($name, $sources_array, $selected, $parameters);
 }
?>

 

 

You see anythign wrong with it cuz i cant :blush:

Link to comment
Share on other sites

Hi there Tom,

 

Excellent contrib. Im a complete novice with all this php/oscommerce stuff and after initially not getting pics displayed i worked through the first few pages here and it's now working :thumbsup:

 

For all you novices like me out there, the thumbnails directory needs to be in the catalog directory and not the images directory :blush: :lol:

 

Cheers

 

Daz

Link to comment
Share on other sites

Actually, got a bit of a weird one. Decided to check everything on my site was ok. All the picture are displaying fine appart from one

 

Any ideas what this means? I've deleted and uploaded the picture again to see if that made any difference, it didn't.

 

Warning: Division by zero in /home/chapel00/public_html/shop/imagemagic.php on line 136

 

Warning: Cannot modify header information - headers already sent by (output started at /home/chapel00/public_html/shop/imagemagic.php:136) in /home/chapel00/public_html/shop/imagemagic.php on line 478

 

Warning: Cannot modify header information - headers already sent by (output started at /home/chapel00/public_html/shop/imagemagic.php:136) in /home/chapel00/public_html/shop/imagemagic.php on line 479

 

Warning: Cannot modify header information - headers already sent by (output started at /home/chapel00/public_html/shop/imagemagic.php:136) in /home/chapel00/public_html/shop/imagemagic.php on line 480

 

This is the output from when i put the popup pictures full URL in a new page

 

Cheers

 

Daz

Edited by daz_75
Link to comment
Share on other sites

ive uninstalled reinstalled and i cant get it working on this new domain same host just got a new domain name for it

 

My includes/functions/html_output.php file is

<?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 (c) 2003 osCommerce

 Released under the GNU General Public License
*/

////
// Ultimate SEO URLs v2.1
// The HTML href link wrapper function
 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
global $seo_urls;		
	if ( !is_object($seo_urls) ){
		if ( !class_exists('SEO_URL') ){
			include_once(DIR_WS_CLASSES . 'seo.class.php');
		}
		global $languages_id;
		$seo_urls = new SEO_URL($languages_id);
	}
return $seo_urls->href_link($page, $parameters, $connection, $add_session_id);
 }
////
// The HTML image wrapper function
// 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 ''; 
} 
} 


//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
////
// 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 .= tep_output_string_protected(stripslashes($GLOBALS[$name]));
} elseif (tep_not_null($text)) {
  $field .= tep_output_string_protected($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);
 }
////rmh referral
// Creates a pull-down list of sources
 function tep_get_source_list($name, $show_other = false, $selected = '', $parameters = '') {
$sources_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$sources = tep_get_sources();

for ($i=0, $n=sizeof($sources); $i<$n; $i++) {
  $sources_array[] = array('id' => $sources[$i]['sources_id'], 'text' => $sources[$i]['sources_name']);
}

if ($show_other == 'true') {
  $sources_array[] = array('id' => '9999', 'text' => PULL_DOWN_OTHER);
}

return tep_draw_pull_down_menu($name, $sources_array, $selected, $parameters);
 }
?>

You see anythign wrong with it cuz i cant :blush:

Link to comment
Share on other sites

Had internet troubles when I tried to make that last post. This should have been at the top of that reply. Sorry.

 

I had the same problem when moving to a new server. I was getting this in my server's http error log.

 

Call-time pass-by-reference has been deprecated - argument passed by value;

 

This is not supported in PHP5.

 

I changed lines 269-274 in imagemagic.php.

 

From:

if (BRIGHTNESS_ADJUST != "0") adjust_brightness(&$tmp_img,BRIGHTNESS_ADJUST);

if (CONTRAST_ADJUST != "0") adjust_contrast(&$tmp_img, CONTRAST_ADJUST);

if ($image_watermark) watermark_image(&$tmp_img, DIR_FS_CATALOG.'includes/imagemagic/watermarks/'.WATERMARK_IMAGE ,WATERMARK_IMAGE_POSITION, WATERMARK_IMAGE_OPACITY, WATERMARK_IMAGE_MARGIN);

if ($frame) frame(&$tmp_img, FRAME_WIDTH, FRAME_EDGE_WIDTH, FRAME_COLOR, FRAME_INSIDE_COLOR1, FRAME_INSIDE_COLOR2);

if ($bevel) bevel(&$tmp_img, BEVEL_HEIGHT, BEVEL_HIGHLIGHT, BEVEL_SHADOW);

if ($text_watermark) watermark_text(&$tmp_img, WATERMARK_TEXT, WATERMARK_TEXT_SIZE, WATERMARK_TEXT_POSITION, WATERMARK_TEXT_COLOR, 'includes/imagemagic/fonts/'.WATERMARK_TEXT_FONT, WATERMARK_TEXT_OPACITY, WATERMARK_TEXT_MARGIN, WATERMARK_TEXT_ANGLE);

 

 

To:

if (BRIGHTNESS_ADJUST != "0") adjust_brightness($tmp_img,BRIGHTNESS_ADJUST);

if (CONTRAST_ADJUST != "0") adjust_contrast($tmp_img, CONTRAST_ADJUST);

if ($image_watermark) watermark_image($tmp_img, DIR_FS_CATALOG.'includes/imagemagic/watermarks/'.WATERMARK_IMAGE ,WATERMARK_IMAGE_POSITION, WATERMARK_IMAGE_OPACITY, WATERMARK_IMAGE_MARGIN);

if ($frame) frame($tmp_img, FRAME_WIDTH, FRAME_EDGE_WIDTH, FRAME_COLOR, FRAME_INSIDE_COLOR1, FRAME_INSIDE_COLOR2);

if ($bevel) bevel($tmp_img, BEVEL_HEIGHT, BEVEL_HIGHLIGHT, BEVEL_SHADOW);

if ($text_watermark) watermark_text($tmp_img, WATERMARK_TEXT, WATERMARK_TEXT_SIZE, WATERMARK_TEXT_POSITION, WATERMARK_TEXT_COLOR, 'includes/imagemagic/fonts/'.WATERMARK_TEXT_FONT, WATERMARK_TEXT_OPACITY, WATERMARK_TEXT_MARGIN, WATERMARK_TEXT_ANGLE);

 

 

 

The only difference is the Ampersand in front of the variable and since the Ampersand is included in the function declaration there should be no ill effects from this change but I'm no PHP expert so test it for yourself. I'm just happy it works for me.

 

Gary

Link to comment
Share on other sites

Hi,

 

I really want to get this working but it doesn't seem to be - but there are aspects suggesting it is!

 

I've installed i/m exactly as the readme - I hope! I/m is in the admin panel etc etc.

 

The url of a thumbnail is:

 

http://localhost/catalog/images/imagecache/w000_wizard.jpg

 

no sign of the imagemagic but is the imagecache something to do with it?

 

In admin the osc logo and online catalog picture don't show but these are adressed as:

 

http://localhost/catalog/admin/imagemagic....=204&h=50&page=

 

Why has this got the imagemagic/php in?

 

Is the thumbnails folder supposed to be here http://localhost/catalog/thumbnails (and is this purely a empty folder?)

 

When i ran the sql script I selected the database and pasted the script, it said it had ran OK.

 

 

I have set the image options in config/images to only have one dimension.

 

 

Does anyone have any pointers?

 

Thanks

 

Becki

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