亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在 php 7.4.10 版本上啟用 Webp 支持?

如何在 php 7.4.10 版本上啟用 Webp 支持?

PHP
紫衣仙女 2024-01-19 16:58:06
我正在 Red Hat Linux 86_64 服務器上使用 php 7.4.10 版本,我想在用戶上傳圖像后將所有圖像自動轉換為 webp 擴展名。我有 php 代碼,可以正常上傳圖像,但是當我嘗試上傳圖像時,出現以下錯誤:Fatal error: Uncaught Error: Call to undefined function imagewebp() in....當我收到上面的錯誤時,我在頁面上輸入了var_dump (gd_info()),之后我得到了以下信息:array(14) { ["GD Version"]=> string(26) "bundled (2.1.0 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPEG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(true) ["XBM Support"]=> bool(true) ["WebP Support"]=> bool(false) ["BMP Support"]=> bool(true) ["TGA Read Support"]=> bool(true) ["JIS-mapped Japanese Font Support"]=> bool(false) }根據上面的數組結果,Webp 支持被檢查為 false:["WebP Support"]=> bool(false)在這種情況下,我如何啟用 WebP 支持["WebP Support"]=> bool(true)?我發現了一些與我的疑問相關的類似問題:更新GD版本以支持PHP 7.3的Webp如何編譯php以啟用webp支持?在 LiteSpeed 上運行的 Ubuntu 18.04 上啟用 GD 庫中的 WebP 支持但不幸的是我沒有找到在我的服務器上啟用 webp 支持的正確方法。
查看完整描述

1 回答

?
繁花如伊

TA貢獻2012條經驗 獲得超12個贊

在全新安裝的 php 中,添加 gd 會sudo apt install php7.4-gd自動啟用 webp。phpinfo() 中的輸出;是:


gd

GD Support  enabled

GD headers Version  2.3.0

GD library Version  2.3.0

FreeType Support    enabled

FreeType Linkage    with freetype

GIF Read Support    enabled

GIF Create Support  enabled

JPEG Support    enabled

PNG Support     enabled

WBMP Support    enabled

XPM Support     enabled

XBM Support     enabled

WebP Support    enabled

BMP Support     enabled

TGA Read Support    enabled 


查看完整回答
反對 回復 2024-01-19
  • 1 回答
  • 0 關注
  • 211 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號