• Resolved achthomas

    (@achthomas)


    Hi there,

    I really like the plugin and its ease of use, great work!

    It seems like I stumbled over a bug, since I couldn’t find a cure for the behavior. I registered some additional image sizes, one of them being 900×450. When I upload an image smaller than those dimensions (say: 640×480) and edit it with Crop Thumbnails, the plugin warns me that the original images is too small for the largest size (which is correct). But nevertheless it creates an upscaled version of the image in 900×450, which then is of poor quality.

    In my functionality I make use of wp_get_attachment_metadata(), but I cannot rely on the sizes the function returns for edited images, since there might be upscaled versions in the array. I will now do a little workaround and check each created image size against the original file’s dimensions before use. However it would be cool if the plugin took that into account and wouldn’t add upscaled images altogether. Or can I opt out of that option somewhere and I just didn’t see that?

    Thanks
    Thomas

    https://www.ads-software.com/plugins/crop-thumbnails/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    Hi there,
    the plugin is designed to make upscale possible. If the user do not want upscale it could simple leave the image as it is.

    But you are right the metadata should be updated if an upscale happens.

    I had a quick look into the saving process. The attachement_metadata should have been updated. I had all the code in there.
    https://github.com/vollyimnetz/crop-thumbnails/blob/master/functions/save.php
    Line 121-132 and Line 142

    You say the attachements-meta-data did not update?

    Thread Starter achthomas

    (@achthomas)

    Hi Volkmar,

    thanks for you quick reply! I think you misunderstood, there’s no problem with the metadata, everything works correctly.

    Here’s an example. I have registered additional image sizes, onbe of them is 900×450. Then I uploaded an image that’s only 520×347 and wanted to adjust the cropping area. Although the original image is too small, the plugin generates a file with dimensions 900×450. Here’s my wp_get_attachment_metadata() Array:

    Array
    (
        [width] => 520
        [height] => 347
        [file] => 2016/03/01/myfile.jpg
        [sizes] => Array
            (
                [thumbnail] => Array
                    (
                        [file] => myfile-400x267.jpg
                        [width] => 400
                        [height] => 267
                        [mime-type] => image/jpeg
                    )
    
                [feature_large] => Array
                    (
                        [file] => myfile-900x450.jpg
                        [width] => 900
                        [height] => 450
                        [crop] => 1
                    )
    
            )
    
        [image_meta] => Array
            (...)
    )

    You see: the plugin creates an image which is larger than the original one, does all the metadata updating correctly. But: this puts low-quality images into the system since they’re larger than the uploaded original. You get what I mean?

    Maybe my assumption is wrong that nobody would upscale an image beyond its original size (since this results in poor image quality), but I might be wrong.

    In my code I can circumvent this, but if this really is a bug (and not a feature;) this might be worth some consideration in a future update. I’d appreciate that!

    Thanks
    Thomas

    Plugin Author Volkmar Kantor

    (@volkmar-kantor)

    For me, it makes perfect sense to give users the possibility to fix a image sizes, even if it results in images with less qualtity. Think about: cropped image sizes are important for web-developer like me – it makes sure a image had a certain proportion and size.

    I have a lot of clients which are not as fit with desktop image-manipulation as me (or not care about). With my plugin i create an easy tool to stil get the right dimensions for an image (so there theme dont look so messy).

    Thread Starter achthomas

    (@achthomas)

    ok, i get your point. in this case this may indeed be desirable. maybe you want to consider an optional switch for people who’d like to prevent upscaling in a future update. that’d be really cool and make the plugin even more versatile. for now: thanks for the tool and your quick support!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Plugin upscales images that are too small’ is closed to new replies.