• 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.

Medium Thumbnails: Add option to scale "long side" of image.

Jonas

Chevereto Member
Hi and thank you for this nice image hosting script. Currently I am trying the free version (1.0.0).
I understand that most people need either fixed width or fixed height on their preview pics, so they look good in blogs etc.

I want to use the image hosting to post my pics on different forums, however. Most of the time, it's a single picture. It is a bit awkward that one orientation is much bigger than the other (e.g. medium is set to "width", 1024px. When I upload a landscape image from my phone's camera, it's scaled to 1024x768. However, uploading a portrait image gives me a 1362x1024 file.

Adding a "long side" option would give me 1024x768 / 768x1024 pics, which is what I want.

Implementing it is not very difficult:

class.settings.php:82
PHP:
if(!in_array($settings['upload_medium_fixed_dimension'], ['width', 'height', 'longside'])) {

class.image.php:764
PHP:
// Try to generate the medium
            $medium_size = getSetting('upload_medium_size');
            $medium_fixed_dimension = getSetting('upload_medium_fixed_dimension');

            if($medium_fixed_dimension == 'longside'){
                $fileInfo = $image_upload['uploaded']['fileinfo'];
                $width = $fileInfo['width'];
                $height = $fileInfo['height'];

                if($width>=$height){
                    $medium_fixed_dimension = 'width';
                } else{
                    $medium_fixed_dimension = 'height';
                }
            }

Of course it needs to be added in the dashboard as well, so the user can choose the option:

dashboard.php:781
PHP:
                        echo CHV\Render\get_select_options_html(['width' => _s('Width'), 'height' => _s('Height'), 'longside' => _s('Long Side')], CHV\Settings::get('upload_medium_fixed_dimension'));

Now, this is only a hasty fix and you might want to do it differently (using constants etc.).

But I think the feature would be appreciated by many users, not just me.

All the best,

Jonas
 
Back
Top