Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 337

phpBB Discussion • Re: [Split]Compressing uploaded image attachments?

$
0
0
Well, that's a dead link now. I've been looking for the same.
Our "files" folder is now +4GB and most are images. I can very easily run a script to convert them all to webp and shrink the directory by at least 60% while keeping them looking the same, but how do I update the db with the new sizes etc?
This would be greatly appreciated by many users, I think. The webp format is already on many sites by default. WordPress itself, with its domain i0.wp.com, does it for free.

Look at the difference in practice.

This is an original example image with 224kb (a white image with text)
https://thall.es/test.png

Now look at it converted to webp https://i0.wp.com/thall.es/test.png 61kb in webp format

This would be great in the optional core for those who want it. It would save a lot of storage, which I think not everyone has unlimited, and it would also improve the page loading speed a lot.

In practice, in PHP, to implement it:

Example of the code

Code:

imagepalettetotruecolor($img);imagealphablending($img, true);imagesavealpha($img, true);imagewebp($img, $dir . $newName, 80); <-- Image quality from 0 to 100 with 100 being the best quality
Only GIF images would not be compatible with this conversion because they would be static, but just ignore them and not Convert.

Come on PHPBB team, support the idea 😁

Statistics: Posted by MestresHackers — Sun Dec 22, 2024 12:21 pm



Viewing all articles
Browse latest Browse all 337

Trending Articles