Zen Cart Logo
Forums / General Questions / zen_image vs zen_image_OLD

zen_image vs zen_image_OLD

Views: 1,659

Results 1 to 3 of 3
27 Mar 2013, 1:20 PM
#1
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,016
Plugin Contributions:
2

zen_image vs zen_image_OLD

I have a few questions about the zen_image_OLD function, which was created many years ago when replaced by the zen_image function.

The zen_image_OLD function only exists in \includes\functions\html_output.php, while the zen_image function exists in both \admin\includes\functions\html_output.php and \includes\functions\html_output.php.

  1. Is zen_image_OLD likely to become obsolete any time soon?

  2. Now I have been using code similar to the following ever since static html days and in certain non-admin zencart pages to automatically reduce the size of a large image to fit within its div, whilst maintaining the proportions of that image.

This code works as intended using the zen_image_OLD function, but when the zen_image function is used, a large image is fitted to its enclosing div but loses its proportionality.

<div class="event_image_outer">
  <div class="event_image_inner">
     <!-- Note: closing ' />' for <img> is located in function zen_image -->
     <img class="c1" <?php echo zen_image(DIR_WS_IMAGES .'events_images/' . $event_array['image'], '', '', 'hspace="0" vspace="0"');?>
  </div>
  <div class="clearLeft"> </div>
</div>

CSS for the above code:

.event_image_outer {width:100%; margin:2em auto;}
.event_image_inner {width:98%; margin:0.5em auto; text-align:center;}
img.c1 {max-width:100%; margin:0em auto;}

I would greatly appreciate if someone could explain, or provide a solution for, why the above code does not work properly with the zen_image function.

  1. Upon comparing the zen_image (and other) functions in \admin\includes\functions\html_output.php with \includes\functions\html_output.php, I notice some functions end thereabouts without a forward slash:
$image .= ' >';  (or $whatever .= ' >';)

while the same functions in the includes file end thereabouts with a forward slash:

$image .= ' />';  (or $whatever .= ' />';)

Is there a reason why the admin functions do not have the closing slash (ie '/>') ?

Thanks

27 Mar 2013, 2:58 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: zen_image vs zen_image_OLD

zen_image_OLD is used for template images, language files and for when the setting in Configurations ... Images ... is set to 0 for:

Image - Use Proportional Images on Products and Categories
Use Proportional Images on Products and Categories?

NOTE: Do not use 0 height or width settings for Proportion Images
0= off 1= on

as to the closing slash the Admin has not been cleaned up as much as the Catalog ...

31 Mar 2013, 3:15 PM
#3
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,016
Plugin Contributions:
2

Re: zen_image vs zen_image_OLD

Hi Ajeh

Since I need Proportion Images = 1, I changed zen_image to zen_image_OLD, and it is working as desired.

Thanks