- Posts: 3
COMMUNITY FORUM
<?php echo $this->item->imageWidth; ?>, Height?
- Safak Cenan
-
Topic Author
- Offline
- New Member
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.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
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
-
Topic Author
- Offline
- New Member
- Posts: 3
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.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
Please Log in or Create an account to join the conversation.
- itchibahn
-
- Offline
- New Member
- Posts: 3
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.
- CENTAURE
-
- Offline
- New Member
- Posts: 4
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.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
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.
- CENTAURE
-
- Offline
- New Member
- Posts: 4
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.
- CENTAURE
-
- Offline
- New Member
- Posts: 4
span.catItemImage img {
max-height:80px;
max-width:100px;
}
and this is perfect!
Please Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
Please Log in or Create an account to join the conversation.