Tidypics enlarging images on view.

On my Elgg installation (Release - 1.10.1, Version - 2014130300) and Tidypics 1.10.6. Some of our images are small to start with and when a user clicks on them it enlarges them beyond their original size.

Is there a way to stop images that are already smaller than the view size being enlarged?


Drew

  • There's no plugin option to prevent upscaling of small images.

    Tidypics creates 3 resized images: tiny (by default 60x60), small (153x153) and large (600x600). Additionally, the original image file is used when viewing the image in a lightbox popup.

    The tiny and small images are not only resized but also cropped (made squared). As they are used at different places (e.g. album list view, widgets etc.) I wouldn't suggest to change the cropping. Changing the size these versions of the images should be created with is possible in the Tidypics plugin settings. But changing the default size will very likely result in adjustments in the site's theme to become necessary for the page layouts to look good. I also don't think it would make much sense in making the size of these thumbnails even smaller as it would get really difficult to see anything on them at all then. Also, if upscaling would really occur for even these small sizes I wouldn't expect that the size would have to get increased much.

    The large size of the images is very likely the size you are referring to (this size is used on the full view pages of a single image). Default size is 600x600 with keeping the aspect ratio. On downsizing this means the width or height (whichever is larger) is reduced to 600 px and the other dimension is reduced with the same ratio (resulting it to be smaller than 600 px then). On upscalling the process would be the other way round. The larger dimension of width or height is increased until it's 600 px with the other dimension increased for the same ratio.

    The whole resizing happens in mod/tidypics/lib/resize.php. If you don't want upscaling to happen, you would have to add some code for comparing the original image sizes with the target image sizes and in case the original image dimensions are smaller set the target image size to the original image size. In this case a copy of the original image would get created with the same dimensions. Most likely it would be even better to omit the re-size process for these cases (some - even mostly not noticeable - quality loss always happens on the resizing) and simply return the original image without performing the resize at all.

    As Tidypics can deal with 3 different image libraries you would have to prevent the upscaling to happen for any of the 3 libraries used but at least for the library you do use on your site. The re-size code for all 3 libraries is in mod/tidypics/lib/resize.php.

  • iionly,

    Thank you for such a thorough explanation. I am using imagemagick at the moment so will take a look in the file to see if I can find anything.

    I have kept all the faults for Tidypics and don't intend to change them. The upscaling is not a deal breaker. 

    Again thank you for your time.

    Drew