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

Enable custom parameters for .webp and .avif thumbnails #876

Merged
merged 3 commits into from
Mar 5, 2025

Conversation

onli
Copy link
Member

@onli onli commented Feb 26, 2025

The thumbnail code assumed that images are .gif, .png or .jpg, and we defaulted to quality settings for .jpg thumbnails. But for both .avif and .webp, other quality settings are preferable (and possible other additional parameters).

This code changes the code for $serendipity['imagemagick_thumb_parameters'] so that it can be an array, with the image mime type as key and their specific parameters as values. It also sets sane defaults for the gd path for both formats, which also enables thumbnails in both formats when imagemagick is not used.

The thumbnail code assumed that images are .gif, .png or .jpg, and we defaulted to quality settings for .jpg thumbnails. But for both .avif and .webp, other quality settings are preferable (and possible other additional parameters).

This code changes the code for $serendipity['imagemagick_thumb_parameters'] so that it can be an array, with the image mime type as key and their specific parameters as values. It also sets sane defaults for the gd path for both formats, which also enables thumbnails in both formats when imagemagick is not used.
@onli onli requested a review from garvinhicking February 26, 2025 16:04
@onli
Copy link
Member Author

onli commented Feb 26, 2025

My uberspace dev server does not support .avif in the gd path yet, so .avif thumbnail creation with gd is untested. Should work fine though.

I also got a gateway timeout right now when uploading images after switching to imagemagick, but the thumbnails got properly created. An uberspace hickup? I will check again later. Edit: Yes, just a hickup, likely a slow server.

@onli onli merged commit 058c237 into master Mar 5, 2025
5 checks passed
@onli onli deleted the feature/optimizedImageParams branch March 5, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant