- Posts: 23
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- creat thumbnail by width and height. you can input height value on K2 control center
creat thumbnail by width and height. you can input height value on K2 control center
- vanshion
-
Topic Author
- Offline
- Junior Member
param menu="hide" name="catImageHeigh" type="text" default="100" size="4" label="Category image height (in px)" description="" /
add these code to 33 line on config.xml
param menu="hide" name="userImageHeight" type="text" default="100" size="4" label="User image (avatar) width (in px)" description="" /
these can set height value about category image and userimage.
Please Log in or Create an account to join the conversation.
- vanshion
-
Topic Author
- Offline
- Junior Member
- Posts: 23
$handle->image_ratio_crop = true; //crop image
$handle->image_ratio_crop = false; //don't crop image
this line code can do this! but I haven't found which XML is. Maybe we should add a new XML file. I believe Lukas can achieve it
Sébastien said:Yes ! I think the original settings were good for some people or for some content (for exemple for DVD reviews when you l
Please Log in or Create an account to join the conversation.
- vtiger
-
- Offline
- Premium Member
- Posts: 83
Regards,
l
panagiotis said:However I have a question: If I apply this hack will I need to re-upload all the images in my K2 items?
Please Log in or Create an account to join the conversation.
- vtiger
-
- Offline
- Premium Member
- Posts: 83
"function save" seems to be responsible for thumbs creation...
I don't know how exactly your "hack for the automatically cache rebuild" works... But, you are on good way ;)
l
Please Log in or Create an account to join the conversation.
- vtiger
-
- Offline
- Premium Member
- Posts: 83
l
Please Log in or Create an account to join the conversation.
- miquel
-
- Offline
- New Member
- Posts: 5
Please Log in or Create an account to join the conversation.
- A Schlumberger
-
- Offline
- New Member
- Posts: 4
I will need to try with the category images.
Thanks !
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
I removed comment "//" from $handle->image_ratio_y = true; for those large images. Category thumbs are not sa important. They can be cropped.
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
For now, I use the hack for cache image here :
community.getk2.org/forum/topics/image-cache-questions?commentId=3536014%3AComment%3A19447
And I want to add your hack to add possibility to fix height in config files, What I need to do ?
Thanks ;)
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
Could you post all the files you've modify to have the complete hack ?
Thanks ;)
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
And images in Blog layout will allways have same dimensions in px (for instance, all images will be 150 px width X 100px height.)
Just tested and it works perfectly.
Decide width and height in px, then new thing is background-color for part of image block that is over.
So, black color will be top-bottom or left-right, in relation to pictures, depending if you have landscape or some picture with great height. (you can use any color you want)
And chose everything below to suit your needs (tex,S,L,XL)
//Medium image $handle->image_resize = true; $handle->image_ratio = true; $handle->image_convert = 'jpg'; $handle->image_ratio_fill = true; $handle->image_background_color = '#000000'; $handle->jpeg_quality = $params->get('imagesQuality'); $handle->file_auto_rename = false; $handle->file_overwrite = true; $handle->file_new_name_body = $filename.'_M'; if (JRequest::getInt('itemImageM')) { $imageWidth = JRequest::getInt('itemImageM'); } else { $imageWidth = $params->get('itemImageM', '100'); } if (JRequest::getInt('itemImageM_Height')) { $imageHeight = JRequest::getInt('itemImageM_Height'); } else { $imageHeight = $params->get('itemImageM_Height', '115'); } $handle->image_x = $imageWidth; $handle->image_y = $imageHeight; $handle->Process($savepath);
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
www.verot.net/php_class_upload_docs.htm
Amazing what you can achieve with this.
But, you have only 5 shots.
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
So, your code could be repeated with different px value for each format (S, L, XL...) ?
I don't really understand why did you put a color background, your code don't crop the image so it fills the space ?
Thanks again ;)
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
administrator/components/com_k2/models/item.php
Be carefull with this. You need to be sure that this tweak is not used ( XS, S,XL,M,L ) for some Category where you don´t want it this way.
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
If you dont use $handle->image_background_color = '#000000'; then default color is white. It is up to you to decide.
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
But I don't really understand.
If I have an image : 300px * 450px
I want to have a full thumbnail (no black stripes...) of size 200px * 100px.
Your script can do it ?
Thanks ;)
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
Your picture, doesn´t matter if it is landscape od portrait, will allways be centered in image block.
It wont lose proportions.
If you don´t understand. You can have same thumbs in Category blog in pixels (remember borders ?), and still don´t lose proportions and ratio for tex portrait of Barack Obama and for some panorama picture.
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
And you have whole picture naturally, not cropped from center or similar.
Please Log in or Create an account to join the conversation.
- juju
-
- Offline
- Premium Member
- Posts: 119
I'm wrong ?
Please Log in or Create an account to join the conversation.
- BBC
-
- Offline
- Platinum Member
- Posts: 663
I chosed black because i find it more elegant sometimes.
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- creat thumbnail by width and height. you can input height value on K2 control center