Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / How to use the widht / height with the zen_image function

How to use the widht / height with the zen_image function

Views: 1,606

Results 1 to 6 of 6
11 Dec 2015, 9:17 PM
#1
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

How to use the widht / height with the zen_image function

Hi

I'm trying to use the zen_image function, to some images on my template. however, I might be missing something about the use of the width and height, because I get the SMALL_IMAGE values

zen_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

This shoud work ?

zen_image('DIR_WS_IMAGES . $my_image, $my_image_name, 100,100)

Or I'm missing something ?

Thanks

11 Dec 2015, 9:32 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: How to use the widht / height with the zen_image function

Well, 100, 100 is the width and height that you have set in the call to the image function. If that happens to also be the size of your small image, then the image will then look like the size of your small images...

Or are you indicating that the small image which is different than any other image is the image being seen? Ie. Small image is a view from the left, other images show a different perspective...

11 Dec 2015, 10:57 PM
#3
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: How to use the widht / height with the zen_image function

mesnitu:

Hi

I'm trying to use the zen_image function, to some images on my template. however, I might be missing something about the use of the width and height, because I get the SMALL_IMAGE values

zen_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

> 
> This shoud work ? 
> 
> zen_image('DIR_WS_IMAGES . $my_image, $my_image_name, 100,100)
> 
> Or I'm missing something ? 
> 
> Thanksremove the single quote before DIR_WS_IMAGES..

zen_image([B]'[/B]DIR_WS_IMAGES . $my_image, $my_image_name, 100,100)

zen_image(DIR_WS_IMAGES . $my_image, $my_image_name, 100,100)

12 Dec 2015, 8:58 AM
#4
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

Re: How to use the widht / height with the zen_image function

Hi
Thanks
I gave a bad example, I see now I was not getting the right values ie: (400,200) , because the proportional images configuration was set to true.
So, if I use a , ie:

**zen_image( DIR_WS_IMAGES . $publisher_menu->fields['publisher_image'], $publisher_menu_name,400,100, 'property="image"'); **

It's calculated by the height, and I get a 100x100 img.
But, not using the proportional images for the all site, it's a big headache.
Probably, my best option it's to alter the zen_image for this specific use.

Thanks

12 Dec 2015, 10:55 AM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: How to use the widht / height with the zen_image function

mesnitu:

Hi
Thanks
I gave a bad example, I see now I was not getting the right values ie: (400,200) , because the proportional images configuration was set to true.
So, if I use a , ie:

**zen_image( DIR_WS_IMAGES . $publisher_menu->fields['publisher_image'], $publisher_menu_name,400,100, 'property="image"'); **

It's calculated by the height, and I get a 100x100 img.
But, not using the proportional images for the all site, it's a big headache.
Probably, my best option it's to alter the zen_image for this specific use.

Thanks

What are the dimensions of the original image? Are you trying to elongate or stretch the image?

12 Dec 2015, 11:43 AM
#6
mesnitu avatar

mesnitu

Totally Zenned

Join Date:
Aug 2014
Location:
Lisbon
Posts:
597
Plugin Contributions:
0

Re: How to use the widht / height with the zen_image function

I still don't' have a particular use, just trying to understand, to see if it was possible to use this function in some template cases.
for ie:
A image with 800x542

But lets say, for some reason, I wanted to be 500x100
zen_image(DIR_WS_IMAGES . 'image.jpg', 'somenthing',500,100);
It gets calculated and I'll get 148x100. I could by css give my width.

If I use
<img src=<?php echo '"'.DIR_WS_IMAGES . 'image.jpg" width="500" height="100"';?>>
I get 500x100px

I want to have zencart proportional images in 98% ,so I'll be using the <img> if I need to be out of proportional images.

Thanks