• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Thumbnail resize to aspect ratio of full sized image?

TaintedPix

Chevereto Member
Instead of having the static width and height of the thumbnail, is there a way for the thumbnail to be a smaller version of the main pic given its aspect ratio? I know the discussion forum I post on does something similar for the avatars where larger images are shrunk to their aspect ratio, but with the height and width setup as maximum thumb size (depending on which side hits that threshold.

I'm looking to see if this could be done where either the height or the width hits the threshold of 150px will then set the smaller side to the original's ratio.
 
The reason is that thumbnails are a representation of the image and not a miniaturized version of it. This means that the thumbs are fixed images that are attempt to be equal size to don't disturb further applications like a image gallery or the File Manager.

New file sizes will be introduced on 3.0 where you will have full, medium and thumb.

That's why thumbs are fixed, hope you can understand.
 
I think I kind of understand as that the thumbnail is a separate file only representing the full sized image. What is confusing me is how the thumbs are then chosen for the sizing. Is it that the shorter sides of the original image is set to fill the thumbnail depending if that shorter side is the height or width. As for the rest of the image (the longer part), it is then cropped off.

What about this... would there be a way to choose having the thumbnail creation choose the longer side (like width in a landscape pic) to fill, and the shorter side would then just have dead space on either side? I'm just trying to figure out a quick fix that would allow for the full image to be displayed in the thumb rather than it being cropped leading to parts of it being cut off from view.

Rodolfo, which file contains the executing code to create the thumbnails? I know that the defined size are in the config file, but I'm wondering about the coding (probably Java/AJAX) that creates them.
 
includes/classes/class.upload.php

Find this:
PHP:
$this->ThumbResize = new ImageResize($this->working, $thumb_filename, $this->thumb_width, $this->thumb_height, true);

Replace with this:
PHP:
$this->ThumbResize = new ImageResize($this->working, $thumb_filename, $this->thumb_width);
 
@Rodolfo : Hello sir, same as pcunit.

"How do i achieve this in the latest version as there is no includes folder present. "

I am testing the free version, there is no "includes/classes/class.upload.php" present. If in any other way can achieve this aspect ratio thumbnails, I will buy the script and start building up my site. Please help 🙏 which file to edit.
 
You have to either pass the target width or the target height. Change this:

[CODE lang="php" title="app/lib/classes/class.image.php"] // Try to generate the thumb
$image_thumb_options = [
'width' => getSetting('upload_thumb_width'),
'height' => getSetting('upload_thumb_height')
];[/CODE]
To this:
[CODE lang="php" title="app/lib/classes/class.image.php"] // Try to generate the thumb
$image_thumb_options = [
'width' => 500,
];[/CODE]

In the edited code, you will generate thumbnails fixed to 500px width and the height will be automatically determined.
 
Back
Top