WebPP for MyBB
Change the extensions of the existing profile photos to
.webp
and upload the new ones as
.webp
.
🏁 Why We Should Prefer WebP Extension
.webp
is a compression format for image files. It was developed by Google and was announced in 2010. This format offers several advantages over other image formats.
Here are some of the differences between
.webp
format and other formats:
- Better compression:
.webp
format has a better compression ratio than other formats. This results in smaller file sizes and faster loading times.
- Alpha channel support:
.webp
format offers alpha channel support, like some other formats. This allows the background of images to be set as transparent.
- Animation support:
.webp
format offers better animation support than other formats.
- Better color accuracy:
.webp
format has better color accuracy, which results in higher quality images.
- Supported devices:
.webp
format is supported by newer web browsers. However, some older browsers and devices do not support this format.
In summary,
.webp
format offers several advantages such as better compression, alpha channel support, animation support, color accuracy, and faster loading times. However, there are some limitations when it comes to supported devices.
⚙️ System Requirements
PHP >= 7.0, < 8.3.
MyBB >= 1.8.*
ℹ️ Details
👉
https://community.mybb.com/mods.php?acti...w&pid=1548
Feel happy while using it!
sir here i found a issue. for animated image its make still image. and also if i upload webp animated image its also give me warning that not support the file
Yes, it will regenerate avatars with the .gif
extension as inactive. Because it cannot convert .gif
file directly to .webp
format.
I haven't made any changes to the avatar types MyBB supports. If you want, you can also add the .webp
format as follows.
Open the ./inc/functions_upload.php
file:
Find:
if(!preg_match("#^(gif|jpg|jpeg|jpe|bmp|png)$#i", $ext))
Replace:
if(!preg_match("#^(gif|jpg|jpeg|jpe|bmp|png|webp)$#i", $ext))
Also, the plugin has not been tested on .bmp
and .jpe
formats. If you get an error, I'm here to fix it.
(2023-02-20, 03:12 PM)tedem Wrote: [ -> ]Yes, it will regenerate avatars with the .gif
extension as inactive. Because it cannot convert .gif
file directly to .webp
format.
I haven't made any changes to the avatar types MyBB supports. If you want, you can also add the .webp
format as follows.
Open the ./inc/functions_upload.php
file:
Find:
if(!preg_match("#^(gif|jpg|jpeg|jpe|bmp|png)$#i", $ext))
Replace:
if(!preg_match("#^(gif|jpg|jpeg|jpe|bmp|png|webp)$#i", $ext))
Also, the plugin has not been tested on .bmp
and .jpe
formats. If you get an error, I'm here to fix it.
i did it
if(!preg_match("#^(gif|jpg|jpeg|jpe|bmp|png|webp)$#i", $ext))
but still its giving me upload error
The file upload failed. Please choose a valid file and try again.
Do you have webp as a valid upload type in AdminCP / Confiiguration / Attachment Types?
As HLFadmin said, you need to add a new Attachment Type.
ACP → Confiiguration → Attachment Types →
Add New Attachment Type
(Fill as follows.)
Name
.webp
File Extension *
webp
MIME Type *
image/webp
Maximum File Size (Kilobytes)
1024
Attachment Icon
images/attachtypes/image.png
Enabled?
(Yes)
Force Download
(No)
Available to groups
All groups
Available in forums
All groups
Avatar File
(Yes)
Next, open the
./inc/functions_upload.php
file:
Find:
if(!preg_match("#^(gif|jpg|jpeg|jpe|bmp|png)$#i", $ext))
Replace:
if(!preg_match("#^(gif|jpg|jpeg|jpe|bmp|png|webp)$#i", $ext))
Find:
case "image/x-windows-bmp":
$img_type = 6;
break;
Replace:
case "image/x-windows-bmp":
$img_type = 6;
break;
case "image/webp":
$img_type = 18;
break;
Done, this is how it works.