[WordPress] 外掛分享: Another simple image optimizer

前言介紹

  • 這款 WordPress 外掛「Another simple image optimizer」是 2023-04-24 上架。
  • 目前有 10 個安裝啟用數。
  • 上一次更新是 2025-02-01,距離現在已有 92 天。
  • 外掛最低要求 WordPress 5.9 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 8.1 以上。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

raffaelj |

外掛標籤

image | optipng | jpegoptim | compression | optimization |

內容簡介

總結:此 WordPress 外掛可透過 Spatie image-optimizer library 和主機系統上的二進制文件來優化上傳的圖片 (包括 jpg、png、gif、webp 和 svg 等格式)。除自動優化新上傳的圖片和所有圖片尺寸外,亦可直接優化之前上傳的圖片。但該外掛會將圖片替換為已優化的版本,建議使用前先備份原始檔案或評估風險。

問題與答案:
問題:此外掛能優化哪些圖片格式?
答案:此外掛可優化上傳的圖片,包括 jpg、png、gif、webp 和 svg 等格式。

問題:如何直接優化之前已經上傳的圖片?
答案:可以在媒體庫中切換至列表模式並啟用新的“優化”欄位,然後點擊一個連結可直接優化之前已經上傳的圖片。

問題:該外掛會自動優化新上傳的圖片嗎?
答案:是的,該外掛會自動優化新上傳的圖片和所有圖片尺寸 (縮略圖)。

問題:如何更新現有圖片?
答案:可使用 cli wp media regenerate 來更新現有圖片,這也會觸發優化鏈。如果沒有 cli 存取權限,也可以使用其他工具來重新生成現有的縮略圖。

問題:使用該外掛可能需要注意哪些問題?
答案:使用該外掛有風險將原有圖片替換為優化過的版本,因此建議在使用前先備份原始檔案或評估風險。此外,如果缺少所需的二進制文件,此外掛將無法優化圖片,如果不知道如何安裝它們或您的網站寄存服務商不提供,也不要使用此外掛。

原文外掛簡介

Automatically optimize uploaded images (jpg, png, gif, webp, svg, avif) using the Spatie image-optimizer library and binary files on your host system.
New uploaded images with all image sizes (thumbnails) will be optimized automatically.
Previously uploaded images can be updated in two ways:

Use the command line interface (cli) and run wp media regenerate, which also triggers the optimization chain. If you don’t have cli access, some other plugin, that regenerates existing thumbnails should work, too (not tested, yet).
The media library has a new column “File size” in the list view, which displays the new and the old file size. If an image is not optimized, there is a link named “Optimize” to run the optimizer directly.

Warning: Images are replaced with the optimized ones. Create a backup before testing this plugin. If this is a deal-breaker for you, don’t use it.
Important: If the needed binary files aren’t installed, this plugin won’t optimize anything. Don’t use it, if you don’t know, how to install them or if your web hoster doesn’t provide them.
Notice: WordPress has no support for SVG files. Technically this plugin can optimize them, but I didn’t run any tests with plugins, that add SVG support to WordPress. I was able to optimize svg files automatically in a local test setup (see prepare-and-run-tests.sh in the tests folder and search for enable_svg_avif_upload).
For more information and notes about development, checkout the project README.md file on Codeberg
Requirements

PHP function proc_open must be enabled (some web hosts disable it via php.ini)

Settings
Quality settings can be adjusted with constants in wp-config.php:
Set quality for resizing images (GD/Imagick)

define('ASIO_RESIZE_QUALITY_JPEG', 100); // default: 82
define('ASIO_RESIZE_QUALITY_WEBP', 100); // default: 86

Set quality of optimizers

define('ASIO_QUALITY_JPEGOPTIM', 90); // default: 85
define('ASIO_QUALITY_PNGQUANT', 90); // default: 85
define('ASIO_QUALITY_CWEBP', 85); // default: 90
define('ASIO_QUALITY_AVIFENC', 70); // default: 63

Optimization tools
Spatie image-optimizer will use these optimizers if they are present on your system:

JpegOptim
Optipng
Pngquant 2
SVGO 1
Gifsicle
cwebp
avifenc

At least jpegoptim and optipng should be installed.
You can find information about how to install the binary files in the Spatie image-optimizer README.md file.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Another simple image optimizer」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


0.1.2 | 0.1.3 | 0.2.0 | 0.2.1 | 0.3.0 | trunk |

延伸相關外掛(你可能也想知道)

  • Slimage 》Slimage 使用 jpegoptim 和 optipng 在圖片上傳時進行壓縮,它會壓縮 WordPress 生成的縮略圖,但保留原始檔案以便在必要時恢復更改。, 此外,外掛還允許您逐...。

文章
Filter
Apply Filters
Mastodon