Keyword

<?php echo $this->item->imageWidth; ?>, Height?

  • Safak Cenan
  • Safak Cenan's Avatar Topic Author
  • Offline
  • New Member
More
12 years 6 months ago #64365 by Safak Cenan
Hi,

how can i make the same of <?php echo $this->item->imageWidth; ?> for height?

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #64366 by william white
Replied by william white on topic Re: <?php echo $this->item->imageWidth; ?>, Height?
Please tell us more about what you are trying to do. What file are you working with?
When K2 resized images you specify the width, and it sizes them accordingly and scales them. The height is not adjustable, and i always crop my pictures to fit these requirments first.
If you want them all to turn out the same, crop them all the same.

Please Log in or Create an account to join the conversation.

  • Safak Cenan
  • Safak Cenan's Avatar Topic Author
  • Offline
  • New Member
More
12 years 6 months ago #64367 by Safak Cenan
Replied by Safak Cenan on topic Re: <?php echo $this->item->imageWidth; ?>, Height?

William White wrote: Please tell us more about what you are trying to do. What file are you working with?
When K2 resized images you specify the width, and it sizes them accordingly and scales them. The height is not adjustable, and i always crop my pictures to fit these requirments first.
If you want them all to turn out the same, crop them all the same.


I would like to have all pictures with same height, fixed height.

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #64368 by william white
Replied by william white on topic Re: <?php echo $this->item->imageWidth; ?>, Height?
Crop all of your images to the same size before uploading and they will all turn out the same heigth

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #64369 by itchibahn

William White wrote: Crop all of your images to the same size before uploading and they will all turn out the same heigth


And how do you propose to enforce all users to crop the height prior to uploading? Some don't even know how to crop images, they just write their articles and upload the photo came straight out of their camera.

I think there needs to be a setting for height as it does for width...

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #64370 by CENTAURE
Hello,
I have the same worries, most of the time my clients do not know how to edit an image before uploading it, they do not know or dedimmensionner crop an image.
With k2 and JCE I manage to resize images during the upload.
By cons in the list of items in a category, k2 displays images with the width depending on the setting but the height is auto.

What I am about to try to do is this:

If my image is displayed height I with a value of 80px in height and width by car.
If my image is displayed width I with a value of 100px in width and height auto.

here is my code:

If my image is displayed with a high I value 80px in height and width by car.
<? php
if ($ this-> item-> imageheight> = $ this-> item-> imagewidth)
{
echo "style = \" width: auto; height: 80px; \ "";
}
else / / IF
{
echo "style = \" height: auto; width: 100px; \ "";
}

?> />

<? php
if ($ this-> item-> imageheight> $ this-> item-> imagewidth)
{
echo "H". $ this-> item-> imageheight. "-". $ this-> item-> imagewidth;
Else {}
echo "L". $ this-> item-> imagewidth. "-". $ this-> item-> imageheight;
}
?>

But the parameter $ this-> item-> imageheight not return anything.
I realized that this is because K2 supports only the width of the image setting, not the height!

This would require that I get actual dimensions of the image in order to know if it is an image height or width ... and thus change the display

Thank you in advance for your help

Julien

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #64371 by william white
Replied by william white on topic Re: <?php echo $this->item->imageWidth; ?>, Height?
just for testing try adding something like

height:300px !important;
width:auto !important;

to span.catItemImage img in k2.css

If you make sure the height tag is reasonable and probably less that your k2 image size (m,l, xl) etc (a guess) will be, this may work for you

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #64372 by CENTAURE
I tried your solution, but it does not work ...
I really need to detect if the image is horizontal or vertical in order to adjust

but item-> imageheight not return anything

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #64373 by CENTAURE
I found it was enough to change the css:
span.catItemImage img {
	max-height:80px;
	max-width:100px;
}

and this is perfect!

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #64374 by william white
Replied by william white on topic Re: <?php echo $this->item->imageWidth; ?>, Height?
good, i used another workaround in the heigth of the div that contained the contnet and images in the category display and styled all the blocks to a pre-dermined height before and that helped keep things inline in the category view

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum