Jump to content
Sign in to follow this  

Contribution 2094 - Image resize

Recommended Posts



Still have the same problem that my first image in popup_image changes to smaller than others. Here is the popup_image.php code where images are called. If someone could tell is here something that can affect the first image to be smaller than subimages.


<table cellspacing="0" cellpadding="0" border="0" width="580">
   <td width="580" height="410" valign="middle" align="center" style="background-color:#F3F7FA;">
$image = tep_db_fetch_array($result);
if ($image['products_subimage6'] != ''){
$last = '6';
} elseif ($image['products_subimage5'] != ''){
$last = '5';
} elseif ($image['products_subimage4'] != ''){
$last = '4';
} elseif ($image['products_subimage3'] != ''){
$last = '3';
} elseif ($image['products_subimage2'] != ''){
$last = '2';
} elseif ($image['products_subimage1'] != ''){
$last = '1';
} else {
$last = '0';
$next = $invis + '1';
$back = $invis - '1';

if ($invis == '') {
echo tep_image(DIR_WS_IMAGES . $image['products_image']) . '<br />';
else {

  if ((!$invis) || ($invis == '0') ){
  echo tep_image(DIR_WS_IMAGES . $image['products_image']) . '<br />';
  } else {
  $image['products_subimage' . $invis. ''];
  echo tep_image(DIR_WS_IMAGES . $image['products_subimage' .$invis. '']) . '<br />';







Share this post

Link to post
Share on other sites

hello all

I've read all the replies abt the topic. I think my problems is unique...


I got this errors mesg

Warning: exec(): Unable to fork [imageMagick/mogrify +profile "*" -filter Lanczos -quality 75 -geometry 41 "ImageMagick/res/CASIO_RL_300D_7AV_41_50.jpg"]


I test the mogrify in the cmd windows it working fine...


and this is my define line

define('DIR_WS_IMAGES', 'images/');

define('DIR_IMAGEMAGICK', 'ImageMagick/');


define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');


I don't think there is a problem here..


and this is the code I got


copy($src, $filename_small);

exec(DIR_IMAGEMAGICK . "mogrify +profile \"*\" -filter Lanczos -quality 75 -geometry " . $width . " \"" . $filename_small ."\"");


I know the function work up yo line copy...

And I even try to change the "/" to "\" cause I think that how windows works and also hardcode to direct to find 'mogrify' app.. the code like below


// $comand_line = 'C:\Inetpub\wwwroot\watchworxnet\\' .DIR_IMAGEMAGICK . 'mogrify +profile * -filter Lanczos -quality 75 -geometry ' . $width . ' C:\Inetpub\wwwroot\watchworxnet\\' . $filename_small . ' ';

// $comand_line = str_replace("/", "\\", $comand_line);

// exec($comand_line);


and still get the same errors mesg...


Please anyone give me a driection to solve my problems...

Thanks heap

Share this post

Link to post
Share on other sites

no, I am no longer supporting this.


If you going to install this, I would do it on a test site first, take note of what files you edit and if it is successful just copy the edited files across.


I haven't used OSC in some time now but I don't see any reason why it still won't work.

Share this post

Link to post
Share on other sites

Hello all,


I am using osc2nuke, (a modulized version of oscommerce on a phpnuke website) , and I'm trying to implement this contrib. As soon as I update the tep_image function, my site goes down. All I can get is a solid white screen.


I have read through this support forum, and I've thouroughly read through the instructions numerous times without any luck.


I'm confident that imagemagick its self is working properly, as I use it with the Gallery2 module flawlessly.


I've also contacted my webhost to ensure that I'm using the correct path to the imagemagick directory.


Any help is greatly appreciated.

Edited by SubEclipse

Share this post

Link to post
Share on other sites


I just recognized, that the latest Version resimages_1_2_3_4_5_1.zip

doesn't work correctly with SSL.

PNG images for IE are not loaded via secure connection

and it doesn't work for IE7.

So i fixed some code, cause I'm not sure it works in everycase

I post my fix here and u can add it to the contribution repository

if u checked it.


Just exchange the "// If PNG-images showes up, we give IE a chance to show it with transparency anabled" part in html_output.php


- regular expression to check for IE 5 + IE 6 (not IE 7)

- changed HTTP_SERVER . DIR_WS_HTTP_CATALOG . into $link ($link uses HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . in case of SSL)

// If PNG-images showes up, we give IE a chance to show it with transparency anabled

$msie='/MSIE [5|6].+Win./';
if(($type == 3) && preg_match($msie,$_SERVER['HTTP_USER_AGENT']) && !preg_match('/opera/i',$_SERVER['HTTP_USER_AGENT']))
	$image .= ' src="' . DIR_WS_IMAGES . 'blank.gif" align=BOTTOM style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' . $link . tep_output_string($src) . '\', sizingMethod=\'image\');" >';
  $image .= ' src="' . tep_output_string($src) . '">';
return $image;

Edited by Vipa

Share this post

Link to post
Share on other sites

Here's some feedback on this contribution to help it improve:


- There's no error checking on the exec() calll to mogrify. This allows it to silently fail with no feedback, possibly showing a very large image where a thumbnail should be (because the copy to the thumbnail location succeeded, but the mogrify did not). Ideally, the error checking would not only check for an error, but offer helpful suggestions for common cases. For example, if "127" is returned, that means "file not found" I think. It could suggest that the user try the command from the command line, and if it works there, perhaps safe_mode settings need to be adjusted.


- It seems preferable to use "convert" instead of "mogrify". Mogrify requires first copying the large image and then downsizing it. 'convert' does not require the 'copy' command and instead produces the thumbnail directly as output. This could perhaps save a little and disk space of having two copies of the full size image available. "convert" and "mogrify" are part of the same ImageMagick package, so if one is available, the other should be as well.


In the end, I never solved the "127" error code issue for myself, and am going to try the GD-based resizing solution instead, which doesn't require calling an external program, and thus avoids the safe-mode issues.



Share this post

Link to post
Share on other sites

Just to save anyone the time as I just spent an hour kicking myself tracking down a problem when I moved server -


If you think you've got it all right, the images are appearing in the res directory but not resizing and the command line mogrify works. Check that you haven't got PHP_SAFE to on :)



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