Jump to content
Sign in to follow this  
tomjmul

Support thread for the Image Magic contribution

Recommended Posts

Hi mortal,

 

As said in this addon page (http://addons.oscommerce.com/info/6637):

"(...) it also contains a very comprehensive toolbox of 'on-the-fly' image processing functions to both improve your images and, perhaps more importantly, protect them from theft and unauthorized use by your competitors (...)".

It was written by you, I guess, so I supposed you could not get the image...

 

 

Hi :) no. it is not written by me. as "I" write in the very first line. (Allright. as per request in forum im now adding a contribution not made by me)

 

the text you are referring to is made by the original author. secondly. i never claimed that the pictures on my page was protected. but it is possible to protect them. either by watermark or by encryption (but still not when using 3rd party contributions)

Share this post


Link to post
Share on other sites

Does anyone have any idea how to apply imagemagic to additional images popups? Im using Additional Images Module here

 

My main product image does exactly what it should and all my additional image thumbnails reduce in size correctly, the names are encrypted and they are using imagemagic.php but the popup for each of the additional images does not use imagemagic and as a result they are not encrypted and are not watermarked but the main product image is.

 

I assume they are both using tep_image() so am struggling to understand why the additional popups dont seem to work as expected - can anyone provide any help please?

 

Thank you

 

Jason

Share this post


Link to post
Share on other sites

Problem solved, needed to add a line to tep_image definition in includes/functions/html_output.php:

 

Find:

 

//Detect whether this is a pop-up image

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

 

Add after it:

 

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

Share this post


Link to post
Share on other sites

Is there any way of getting this contribution to overlay the product model data for each image onto the popup? So if a product has a product model of ABCD I would like the image to have a watermark saying Product model: ABCD at the bottom left in small text - I can of course get it to create text but not varying text depending on the image.

 

Any ideas?

 

Jason

Share this post


Link to post
Share on other sites
Is there any way of getting this contribution to overlay the product model data for each image onto the popup? So if a product has a product model of ABCD I would like the image to have a watermark saying Product model: ABCD at the bottom left in small text - I can of course get it to create text but not varying text depending on the image.

 

Any ideas?

 

Jason

 

 

Hi. yes. thats possible. i did it with specials,news and sold. but i used image watermark (not that big difference)

 

the way i did this was by adding a argument to the tep_image function

tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"', $product_info['products_model])

 

add the argument to the function

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

 

then in the same function add it to "tep_output_string"

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

 

the in file imagemagic.php after

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

 

copy that code and modify it

	  if ($_GET['model']) watermark_text($tmp_img, $_GET['model'], WATERMARK_TEXT_SIZE, WATERMARK_TEXT_POSITION, WATERMARK_TEXT_COLOR, DIR_FS_CATALOG.'includes/imagemagic/fonts/'.WATERMARK_TEXT_FONT, WATERMARK_TEXT_OPACITY, WATERMARK_TEXT_MARGIN, WATERMARK_TEXT_ANGLE);

 

and modify that last line as you wish. to get the right angle, position and so on.

 

i did not test this mod. but i use a very similar method on a live shop without any problems

Share this post


Link to post
Share on other sites

just noticed that you only wanted the model on popup. then you make the mod on pop.php file only. and not the product_info.php

 

and i forgot that you need to ad a default value in the function

 

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

Edited by mortal

Share this post


Link to post
Share on other sites

Hi Can anyone help with this problem please. I have just installed v1.14 and follwed all the instructions. I have everything working in admin but my shop screen is displaying this

Parse error: syntax error, unexpected '}' in /customers/computerbob.info/computerbob.info/httpd.www/catalog/includes/functions/html_output.php on line 239

 

This is the full code for that page:

 

<?php

/*

$Id: html_output.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2007 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 . tep_output_string($_sid); // Patch 2.2MS2-051113 added tep_

}

 

return $link;

}

 

////

// The HTML image wrapper function

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

 

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

 

// START STS v4.4:

global $sts;

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

// END STS v4.4

 

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 = intval($image_size[0] * $ratio); // Patch osc-060817

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

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

$height = intval($image_size[1] * $ratio); // Patch osc-060817

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

 

// START STS v4.4:

global $sts;

$src = $sts->image_button($image,$language);

if ($src!='')

$image_submit = '<input type="image" src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

else

// END STS v4.4

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

 

// START STS v4.4:

global $sts;

$src = $sts->image_button($image, $language, true); // 3rd parameter to tell tep_image that file check has been already done

if ($src!='') { // Take image from template folder if exists.

return tep_image ($src);

}

// END STS v4.4

 

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) {

global $HTTP_GET_VARS, $HTTP_POST_VARS;

 

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

 

if ( ($reinsert_value == true) && ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) ) {

if (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) {

$value = stripslashes($HTTP_GET_VARS[$name]);

} elseif (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) {

$value = stripslashes($HTTP_POST_VARS[$name]);

}

}

 

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

global $HTTP_GET_VARS, $HTTP_POST_VARS;

 

$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($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name]) && (($HTTP_GET_VARS[$name] == 'on') || (stripslashes($HTTP_GET_VARS[$name]) == $value))) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name]) && (($HTTP_POST_VARS[$name] == 'on') || (stripslashes($HTTP_POST_VARS[$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) {

global $HTTP_GET_VARS, $HTTP_POST_VARS;

 

$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 ( ($reinsert_value == true) && ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) ) {

if (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) {

$field .= tep_output_string_protected(stripslashes($HTTP_GET_VARS[$name]));

} elseif (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) {

$field .= tep_output_string_protected(stripslashes($HTTP_POST_VARS[$name]));

}

} elseif (tep_not_null($text)) {

$field .= tep_output_string_protected($text); // Patch 2.2MS2-051113 added tep_

}

 

$field .= '</textarea>';

 

return $field;

}

 

////

// Output a form hidden field

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

global $HTTP_GET_VARS, $HTTP_POST_VARS;

 

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

 

if (tep_not_null($value)) {

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

} elseif ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) {

if ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) ) {

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

} elseif ( (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) {

$field .= ' value="' . tep_output_string(stripslashes($HTTP_POST_VARS[$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) {

global $HTTP_GET_VARS, $HTTP_POST_VARS;

 

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

 

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

 

$field .= '>';

 

if (empty($default) && ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) ) {

if (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) {

$default = stripslashes($HTTP_GET_VARS[$name]);

} elseif (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) {

$default = stripslashes($HTTP_POST_VARS[$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);

}

?>

 

 

Thanks in advance if anyone can help

Share this post


Link to post
Share on other sites

Thanks for the reply Mortal - I tried this as you laid it out but I get an error:

 

Warning: Missing argument 6 for tep_image(), called in /home/XXXX/public_html/includes/header.php on line 78 and defined in /home/XXXX/public_html/includes/functions/html_output.php on line 301

 

Line 301 is:

 

function tep_image($src, $alt = '', $width = '', $height = '', $params = '',$model) { global $product_info;

 

It also repeats the error with different definition locations varying by image but inlcuding additional_images.php, boxes.php and so on.

Edited by mondeo79

Share this post


Link to post
Share on other sites

Bob Woolnough :

 

try to replace the entire function. not just commenting it out.

 

and return if you have the same problem

Share this post


Link to post
Share on other sites
Thanks for the reply Mortal - I tried this as you laid it out but I get an error:

 

Warning: Missing argument 6 for tep_image(), called in /home/XXXX/public_html/includes/header.php on line 78 and defined in /home/XXXX/public_html/includes/functions/html_output.php on line 301

 

Line 301 is:

 

function tep_image($src, $alt = '', $width = '', $height = '', $params = '',$model) { global $product_info;

 

It also repeats the error with different definition locations varying by image but inlcuding additional_images.php, boxes.php and so on.

 

Hi. as i wrote in the last notice, i forgot to add a default to the function.

 

function tep_image($src, $alt = '', $width = '', $height = '', $params = '',$model) { global $product_info;

 

needs to be

function tep_image($src, $alt = '', $width = '', $height = '', $params = '',$model='') { global $product_info;

 

this is done so that if that is not set in the function call. it is simply blank.

Share this post


Link to post
Share on other sites

SOrry Mortal - I missed that bit!

 

Now the errors are all gone but how do I actually get it to display the model number in the text watermark? Do I need to change something in the admin panel to tell it to use $products['products_model'], for example? I have set text watermarks to on but what text do I need to put into the watermakr text section in admin if anything at all? I have tried $products['products_model'] and it just displays it as is - sorry for being dumb....

Share this post


Link to post
Share on other sites
SOrry Mortal - I missed that bit!

 

Now the errors are all gone but how do I actually get it to display the model number in the text watermark? Do I need to change something in the admin panel to tell it to use $products['products_model'], for example? I have set text watermarks to on but what text do I need to put into the watermakr text section in admin if anything at all? I have tried $products['products_model'] and it just displays it as is - sorry for being dumb....

 

 

Hi. you need to get the model number from somewhere. by a mysql query in the popup file.

 

i was asuming that it was on product info, or that you would be able to get the number yourself from the database.

 

you can try to post the mysql query of that file. and i will modify it for your needs.

 

or you can try yourself. the original popup looks like this

 

  $products_query = tep_db_query("select pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and pd.language_id = '" . (int)$languages_id . "'");
 $products = tep_db_fetch_array($products_query);

 

it needs to pick up the model number also.

  $products_query = tep_db_query("select pd.products_name, p.products_image, p.products_model from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and pd.language_id = '" . (int)$languages_id . "'");
 $products = tep_db_fetch_array($products_query);

 

so you need tep_image to look like this

tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'],'','','',$products['products_model'])

Share this post


Link to post
Share on other sites

THanks Mortal - I had that included anyway as I was previously displaying the product model in the popup but I think I can see the problem I have now.

 

When I look at the source of the popup the image is being included in the source but the format is wrong, my HTML for popup includes:

 

<body onload="resize();">
<img src="imagemagic.php?img=seWoktzbZGVrnm7LiuSiqLXp1NWtprGb3g%3D%3D&w=D4881&h=0&page=popup&model=" width="D4881" border="0" alt="3 Karat Gem Babydoll" title="3 Karat Gem Babydoll"></body>

 

Obviously looking at it there is an error in one of my previous definitions as it is placing model in the wrong variable - I had assumed the error was in the second line in html_output.php but it looks ok to me, I have incluced it below:

 

$image = '<img src="imagemagic.php?img='.$src.'&w='. tep_output_string($width).'&h='.tep_output_string($height).'&page='.$page.'&model='.$model.'"'; 
}
elseif (IMAGE_REQUIRED == 'false') 
{ 
return false; } }

 

Any ideas where I have missed something from?

Share this post


Link to post
Share on other sites

Hi

 

Have a idiot question here. Got chucked in the deep end by taking over a half finished store from somebody. It used to have a link where you can see an enlarged image of the product but that's now disappeared. I want it back! Where do I look to solve this problem?

 

THanks

Share this post


Link to post
Share on other sites
Hi

 

Have a idiot question here. Got chucked in the deep end by taking over a half finished store from somebody. It used to have a link where you can see an enlarged image of the product but that's now disappeared. I want it back! Where do I look to solve this problem?

 

THanks

 

 

you could download a new package and look in file product_info.php

 

but depending on wich kind of popup / enlarged image was used. you need to use another contribution. but for starters. you could download a new package and look in that file. look for tep_image function containing $product['products_image']

 

i could also do the work for you. but thats not why im here.

Share this post


Link to post
Share on other sites

So kind

 

Thanks for the advice Ill go have a look, but let me try sort this out myself first "the quickest way to learn is to get lost and find your own way out" If I cant manage ultimately I will definately take you up on your offer.

Share this post


Link to post
Share on other sites

Hi Jh

 

Ok sorted it out, it was an apostrophe in the product name.

 

Tell me something. How would I know if Image Magic is installed or not?

 

If not where can I read up on what it does and why I should install it?

 

THanks again

Share this post


Link to post
Share on other sites
Hi Jh

 

Ok sorted it out, it was an apostrophe in the product name.

 

Tell me something. How would I know if Image Magic is installed or not?

 

If not where can I read up on what it does and why I should install it?

 

THanks again

 

 

well. several things you could check up on. is there a file in the catalog root folder named imagemagic.php ?

do you have a configuration group named "Image Magic"

 

if not. its probably not installed. you can download the last file in the contribution area. i think thats the most explanation you can get. besides trying it out.

Share this post


Link to post
Share on other sites

Hello,

 

I still can't figure out why my images are not showing anymore. i've gone through the whole theard and couldn't fix it.

 

I got i/m running fine, i did everything correctly.

 

only hight specified for all 3 image variable into configuration/images

 

thumbnails folder got created auto and set 777...

 

image show imagemaig.php in url and thumbails are created in the respected folder.

 

size seems to be ok....but image are just not showing eveywhere on my site.

 

(just to let you know im on local setup not online, but this change nothing i believe)

 

everything seems ok...gd library avail and running...

 

my server caching in (back office...configuration/cache) is turned off.

If going to Tools/cache control...i seems to have an eror telling cache folder doesn't exit...but it does and is set to 777....i beleive this is just a local problem, isn't it?

but anyways server cache is turned off

 

if loading directly in my browser one the image url i got this

 

not that i got url as it should....i/e like http://...../catalog/imagemagic.php?img=images/12.jpg&w=100&h=138&page=prod_info

 

<br />
<b>Warning</b>:  Call-time pass-by-reference has been deprecated in <b>....\www\catalog\imagemagic.php</b> on line <b>279</b><br />
<br />
<b>Warning</b>:  Call-time pass-by-reference has been deprecated in <b>....\www\catalog\imagemagic.php</b> on line <b>280</b><br />
<br />
<b>Warning</b>:  Call-time pass-by-reference has been deprecated in <b>....\www\catalog\imagemagic.php</b> on line <b>281</b><br />
<br />
<b>Warning</b>:  Call-time pass-by-reference has been deprecated in <b>...\www\catalog\imagemagic.php</b> on line <b>282</b><br />
<br />
<b>Warning</b>:  Call-time pass-by-reference has been deprecated in <b>....\www\catalog\imagemagic.php</b> on line <b>283</b><br />
<br />
<b>Warning</b>:  Call-time pass-by-reference has been deprecated in <b>....\www\catalog\imagemagic.php</b> on line <b>284</b><br />
<br />
<b>Notice</b>:  Undefined variable: page in <b>...\www\catalog\imagemagic.php</b> on line <b>57</b><br />

 

note that i edited directory in the code deleting the full adress location before /www/... because it's not needed at all

 

the line 279 to 284 of imagemagic.php are

 

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

 

and the line 57 is (i believe problem may be here but i can't figure out what is wrong)

 

55 if ($_GET['page'] == "prod_info") {
56	  $thumbnail_size=4;
57	  $page_prefix = $page ."prod_info_";
58 }

 

the numbers are not in the code, i added them to let u see the whole function and which is on wich line.

 

I really can't figure out what is problem except something wrong into those 2 last code posted..but it's original code from install

 

the edited code for has beend change in the good html_output.php (in catalog/includes/function/ and NOT in admin/includes/fuction since admin change are now gone in 1.14 version of i/m.

 

I don't know what to say more..if turning off i/m evey pics come back if turning on.. all are missing...like if image wasn't on location specified.

 

Hope i can get help about this.

 

Thank you in advance for your time

Regards,

Share this post


Link to post
Share on other sites

Hi. Fabien

 

im not sure at all what the problem is. i know that the package is working. because im running it on a test shop.

 

i can suggest disabling those lines. especially the filters

 

	//add selected custom filters to the image
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);

 

and i remember that i once had a install where i had to remove the & sign. try that out first.

 

secondly im talking to another guy with the same problem with a godaddy server. all though im not seeing any errors when using the direct link. only a few wierd letters.

Share this post


Link to post
Share on other sites

Oh. no. just tested out the imagemagic.php of the package..... and it failed. i will do a small test. and then i will post the fix or the whole file. asap

 

 

 

sadly enough. it is the same. with no errors. i just forgot to set the rotht owner on the file. to be read correctly :( i had just hoped there was an error in the package.

Edited by mortal

Share this post


Link to post
Share on other sites

Wah, Thank a lot for such a fast reply, it's really appreciated.

 

Looking forward your new reply.

 

Also how about that undefinited variable into line 57

 

<b>Notice</b>:  Undefined variable: page in <b>...\www\catalog\imagemagic.php</b> on line <b>57</b><br />

 

55 if ($_GET['page'] == "prod_info") {
56	  $thumbnail_size=4;
57	  $page_prefix = $page ."prod_info_";
58 }

 

the numbers are not in the code, i added them to let u see the whole function and which is on wich line.

 

does it seems alright to you?

 

thank you again for your time and such a fast support.

 

Greetings, Fabien.

 

Also as a last note, i saw somewhere in the theard that contrib was deleted at a time..was it a problem with unrelease under GPL lisence...there is no problem using contrib as it's right? since imagemagic doesn't show standard GPL lisence at top of the page.

Share this post


Link to post
Share on other sites

i just tried to replace all my files and functions with those from the contribution package and it all worked fine. and i checked your line. and its the same as mine.

 

i dont know why it was deleted. if it was a metter of support, or licence. i dont know. i never heard such things before, but im not saying they are untrue. but when posting them here at osc. i guess its GPL no matter what. and even since its clearly stated that some of the code is from another contribution.

 

i will try my best to troubleshoot on this. but since im not the author. and dont have full insight in this code. i canot promise anything

 

 

Did you set this "calculate image sizes to true "

and try disabling both cache options in imagemagic admin settings

Edited by mortal

Share this post


Link to post
Share on other sites

Yeah

 

calculate image size in configuration/image is to true

 

i just tried set to false both

 

cache thumbnails on the server

and

cache thumbnails in user brower

 

and i still don't have pic showing.

 

-----

Ill go through this so you can tell me if i did something wrong or forgot something, it may come from there with that undefinited function error.

 

1. added sql to my database

2. i uploaded

 

- imagemagic.php to catalog directory

 

- imagemagic folder to catalog/includes

 

3. modifed/added code into:

 

- added the whole "function tep_cfg_readonly($value){" at the end of catalog/includes/funtions/general.php before the last ?>

 

i did right there? it's not in catalog/admin/includes/functions/general.php

right?

If i remember right, the first time i installed i added code in admin/includes/functions/general.php but it didn't worked

after i saw admin part was deleted

so i added into catalog/includes/functions/general.php instead and it worked..creating thumbnails folder and so on..showing imagemagic.php into picture URL..

 

- modified the function "function tep_image" into catalog/includes/functions/html_output.php

 

the whole image function strat from

 

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

 

to

 

 return $image;
}

 

the whole function is very long and is not only 5/6 lines long

Right?

 

if im not wrong on last 1.14 version of i/m there is nothing to change in catalog/admin files.

 

did i forgot or did something bad in processing intall?

 

Thanx again trying to help me fix my problem!!

Share this post


Link to post
Share on other sites

i dont think the problem lies there. as long as you see imagemagic.php? as the picture. then the function is working. i think the problem lies in the imagemagic.php file somewhere.

 

and yes. the whole function is pretty long. if only there were som more errors. it seems

 

you shold be able to comment this line out. as it only determines the specific height on product info.

	  $page_prefix = $page ."prod_info_";

 

do you see any errors when comment all those lines out ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×