如何在PHP中创建.webp图像 [英] How to create a .webp image in PHP
问题描述
如何使用PHP创建 .webp
图像?
How do you create .webp
images using PHP?
现代版本的PHP(> = 5.5。 0)可以使用 WebP
支持进行编译,但是从我看到这在许多Web主机上并不常见。如果使用WebP支持进行编译,您可以使用内置的 imagewebp()
功能创建 .webp
图像。
Modern versions of PHP (>= 5.5.0) can be compiled with WebP
support but from I've seen this isn't common on many web hosts. If compiled with WebP support you can use the built-in imagewebp()
function to create .webp
images.
使用PHP创建 .webp
图像的替代方法是什么?库,API等其他方法?
What are the alternatives for creating .webp
images using PHP? Libraries, APIs other methods?
推荐答案
目前可用的选项包括:gd,imagick,cwebp(exec-call)或调用云服务。我在github上创建了一个库'webp-convert',它尝试了所有方法。自述文件描述了每种方法的优缺点。它可以在这里找到: https://github.com/rosell-dk/webp-convert
The options currently available are: gd, imagick, cwebp (exec-call) or calling a cloud service. I have created a library 'webp-convert' on github which tries all methods. The readme-file describes the pros and cons of each method. Its available here: https://github.com/rosell-dk/webp-convert
这篇关于如何在PHP中创建.webp图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!