Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting skip_original to true should return the image resized to maximum allowed dimensions by default. #184

Open
hakakou opened this issue Oct 26, 2021 · 2 comments

Comments

@hakakou
Copy link

hakakou commented Oct 26, 2021

Assume I don't want users downloading the original image, neither in it's original size. I suggest that if the following options are set, then calling "image.jpg" without any parameters, should resize to the max_width and max_height.

return array(
    'max_width'     => 1500,
    'max_height'    => 1500,
    'skip_original' => true,
);
@mosbth
Copy link
Owner

mosbth commented Oct 27, 2021

So, skip-original is doing its work as it should and this can be configured as a default setting.
https://cimage.se/doc/troubleshoot#skip-original

The need is then to set a max width/height when someone is accessing a image without width/height.

This might be good when one have larger images in the image set, then it perhaps makes sense.

There is a setting of max width/height, but that is a way to prevent misusage.
https://cimage.se/doc/config-file#maxdimension

I assume that one way to "fix" this would be to implement it using the hook.
https://cimage.se/doc/config-file#hook

if no height nor width is set, then use maxdimensions.

This however makes no sense for images smaller than max dimensions. I assume one would want to leave them alone.

The hook does not know about the actual image size, so that is hinder.

Another way to achieve the wanted result is to preporcess the images to be of a max size. This is my default strategy.
https://cimage.se/doc/use-case#strategy

I would either use something like a bash-script to manage all the images to create a larger web-version of the source images, something like this (and combine it with image Magick convert to downscale larger images). Its an old script, but it might give you some ideas.
https://github.com/cimage/optimize-images

Imagemagik and mogrify would be my way of doing this pre-downscaling of the larger images.
https://imagemagick.org/script/mogrify.php

If implementing this into Cimage, I guess a configuration option in the configuration file could solve this, for all images larger than the max size.

@hakakou
Copy link
Author

hakakou commented Oct 27, 2021

I understand your logic and it makes sense.

In my case it would be convenient to keep in the "img" folder the original, high-res version of the images, without pre-downscaling all of them. This simplifies the workflow for the creators as it can be used like an archive, and if a decision is made to allow a different max dimension for the end-users, they do not need to be replaced again.

May I suggest for this case a new set of (optional) options called "defaultwidth" and "defaultheight", which would be used when no width/height is set from the query? Even if that means upscaling smaller images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants