Fixed Image quality for client side resizing is hardcoded

Kirby

Well-known member
Affected version
2.3.0 Beta 2
The image qulity (0.85) for client side resizing is hardcoded somewhat deep inside XF.ImageTools.resize.

With XenForo 2.2 it was rather easy to change to quality (via a class extension), but doing this with client side resizing currently seems to be much more invloved.

Could XF.ImageTools.resize be changed to smth. like

Code:
XF.ImageTools =
{
    getQuality (file) { return 0.85 },

    resize (file, maxWidth, maxHeight, asType, quality)
    {
        return new Promise((resolve, reject) =>
        {
            [...]

            quality = quality || this.getQuality(file)

            [...]
                canvas.toBlob(
                    [...],
                    asType,
                    quality

?
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.0 Beta 3).

Change log:
Add a new config.php option for image quality that is used as a default for Imagick and GD drivers, and XF.ImageTools.resize. Also add a `getQuality` to XF.ImageTools for easier overriding.
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom