[WordPress] 外掛分享: Plus WebP or AVIF

首頁外掛目錄 › Plus WebP or AVIF
5,000+
安裝啟用
★★★★
4.6/5 分(26 則評價)
76 天前
最後更新
問題解決
WordPress 6.6+ PHP 8.1+ v5.11 上架:2019-05-13

內容簡介

產生 WebP

在媒體庫加入圖片檔時,同時產生相對應的 WebP 檔案。
透過 AJAX 批量製作網站上所有圖片的 WebP 檔案。
在背景中製作網站上所有圖片的 WebP 檔案。
選擇性地,可以在加入新媒體時取代該圖片檔案為對應的 WebP 檔案,並刪除原始圖片檔案。同時,當製作所有圖片的 WebP 時,原始圖片檔案的 ID 會被覆寫為 WebP 檔案的 ID,並且原始圖片檔案會被刪除。內容中的所有圖片連結也會被取代成對應的 WebP 連結。

外掛標籤

開發者團隊

⬇ 下載最新版 (v5.11) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Plus WebP or AVIF」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Generate WebP or AVIF

Generate WebP or AVIF file when adding image file in Media Library.
Generate WebP or AVIF from all the images by async/await.
Optionally, Can replace image files with WebP or AVIF when adding new media, and delete the original image file. Also, when generating all images, the original image file ID will be overwritten as WebP or AVIF and the original image file will be deleted. All URLs in the content are also replaced.

WP-CLI
WP-CLI commands are available. If you have a large number of files, WP-CLI commands is more reliable.
* wp pluswebpavif
* wp pluswebpavif webp -> Generated WebP.
* wp pluswebpavif avif -> Generated AVIF.
* wp pluswebpavif help -> Specification of this command.
* wp pluswebpavif webp mail -> Send results via email.
* wp pluswebpavif webp replace -> WebP or AVIF replacement of images and contents.
* wp pluswebpavif avif addext -> Append the webp or avif extension to the original filename.
* wp pluswebpavif webp --pid=12152 -> Process only specified Media ID(Conversion source ID).
* wp pluswebpavif avif --quality=90 -> Specifies the quality of WebP or AVIF.
* wp pluswebpavif webp --types=image/png,image/gif -> MIME type to convert.
How it works

Filter hooks
/** ==================================================
* Filter for advanced change database.
* If you want to replace other databases besides content.
*/
add_filter(
'plus_webp_advanced_change_db',
function( $before_url, $after_url ) {
/* Your processing */
return array( $before_url, $after_url );
},
10,
2
);

延伸相關外掛

文章
Filter
Apply Filters
Mastodon