Zen Cart Logo
Forums / Bug Reports / Suggestion to fix an image problem

Suggestion to fix an image problem

Locked

Views: 747

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
30 Oct 2009, 2:56 AM
#1
securit avatar

securit

New Zenner

Join Date:
Oct 2009
Location:
Nelson, NZ
Posts:
26
Plugin Contributions:
0

Suggestion to fix an image problem

I find the system overriding the image size settings supplied to the function when there is a leading '/' or when only the width or only the height is specified.

To avoid that, in the html_output.php file can I suggest a small modification to the zen_image function at or around line 245

  // only use proportional image when image is larger than proportional size
  if ($image_size[0] < $width and $image_size[1] < $height) {
    $image .= ' width="' . $image_size[0] . '" height="' . intval($image_size[1]) . '"';
  } else {
    $image .= ' width="' . round($width) . '" height="' . round($height) . '"';
  }
} else {
   // override on missing image to allow for proportional and required/not required
  if (IMAGE_REQUIRED == 'false') {
    return false;
  } else {
    $image .= ' width="' . intval(zen_not_null($width)  ? $width  :  SMALL_IMAGE_WIDTH) . '" height="' . intval(zen_not_null($height) ? $height : SMALL_IMAGE_HEIGHT) . '"';
  }
}

30 Oct 2009, 4:56 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Suggestion to fix an image problem

securit:

... when there is a leading '/'
In what situations are you passing a leading '/' ?
The only part of the logic in that section of the file that would relate to a problem with a leading '/' would be if you've specified a $src image file/path that doesn't exist on the server.
As such it would seem that adjusting width/height in such a situation would be moot, since you've specified a non-existing image.