[WordPress] 外掛分享: ShortPixel Adaptive Images – WebP, AVIF, CDN, Image Optimization

WordPress 外掛 ShortPixel Adaptive Images – WebP, AVIF, CDN, Image Optimization 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「ShortPixel Adaptive Images – WebP, AVIF, CDN, Image Optimization」是 2018-12-08 上架。
  • 目前有 10000 個安裝啟用數。
  • 上一次更新是 2025-04-21,距離現在已有 11 天。
  • 外掛最低要求 WordPress 4.7 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 5.6.40 以上。
  • 有 142 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

shortpixel |

外掛標籤

AVIF | webp | convert | lazy load | image optimization |

內容簡介

ShortPixel Adaptive Images 是一款易於使用的外掛程式,讓您能夠在一分鐘內解決任何圖像相關問題,並提高您的網站核心網頁要素。通常,圖像是網頁上最消耗資源的部分。透過一個按鈕,ShortPixel Adaptive Images 便能為您的網站替換正確大小、智慧裁切和優化的圖像,並上傳至 ShortPixel 的全球 CDN。為了讓您的網站更受 Google 青睞,本插件還能自動分配給支援 WebP 或 AVIF 圖像格式的瀏覽器。使用 ShortPixel Adaptive Images 也能協助 Core Web Vitals(CWV)最大內容繪製(LCP)、首次輸入延遲(FID)和累積佈局偏移(CLS)的改善。這是 Google 用來評估網頁排名的 SEO 要素之一。CWV 值越小,就越能提高網站的排名。

若您是使用 WordPress 網站的使用者,且網站含有圖像,那麼您可能需要 ShortPixel Adaptive Images。當您使用 PageSpeed Insights 或 GTmetrix 測試網站時,是否曾收到過關於圖像大小不適當或過大,或應使用 WebP 或 AVIF 圖像等的指摘,或是網站應「延遲載入畫面外圖像」等的需求?本插件將能迅速解決您網站中圖像相關的問題。此外,本插件還能最小化 CSS、JS 和字型檔案,並將它們從全球 CDN 中傳輸。

以下是本插件的特點:
- 新的輕量化 JavaScript Adaptive Images 引擎(不再需要 jQuery)
- 適當裁切,藉由 ShortPixel 算法而保有一致的視覺品質,但卻有較小的圖像檔案大小
- 根據瀏覽者的畫面大小提供適當大小的圖像
- 支援調整門檻的延遲載入畫面外功能,並可使用瀏覽器原生的延遲載入畫面外功能
- 自動向支援該格式的瀏覽器提供 WebP 和 AVIF 圖像。同時,還支援動畫 GIF 幀轉換為動畫 WebP 和動畫 AVIF!
- 提供全球 CDN 的圖像、CSS、JS 和字型檔案快取和傳輸
- 自動將 CSS/JS 檔案進行最小化
- 支援大部分的圖像庫、滑動瀏覽器和頁面建構器
- 包含啟用嚮導,讓您可以為每個網站推薦最佳設定
- 支援低品質影像佔位符(LQIP)
- 支援使用 JPEG、PNG、GIF、TIFF 和 BMP 格式的圖像
- 無須另外安裝 WebP 或 AVIF 原始檔轉換插件,原始圖像會自動轉換為 WebP 或 AVIF 格式
- 支援調整圖像大小斷點
- 可停用已登入的使用者的插件功能
- 提供多種不同的排除選項,包括進階圖像檢查工具
- 擁有簡單和進階設置模式,讓您可增加插件功能的靈活性。

您無需建立帳號即可測試此外掛程式,只需在 WordPress 網站上安裝並啟用即可。您也會自動獲得每月 500 MB 的 CDN 流量。

原文外掛簡介

An easy-to-use plugin that lets you solve any problems with images and improve your website’s Core Web Vitals in a minute.
Imagine if you could solve all your website’s image-related problems and increase pagespeed and performance with a simple click, would not that be great?
Usually, images are the biggest resource on a web page. With just one click, ShortPixel Adaptive Images replaces all the pictures on your website with properly sized, smartly-cropped and optimized images and uploads them to ShortPixel’s global CDN.
And for even more Google love, the plugin delivers next-gen WebP or AVIF images to the right browsers auto-magically! 🙂
Using ShortPixel Adaptive Images also helps with Core Web Vitals (CWV)‘s Largest Contentful Paint (LCP), First Input Delay (FID) and Cumulative Layout Shift (CLS).
This is an important SEO factor that Google uses to rank pages. The smaller the CWV values are, the better for your website.
Do I need this plugin?
If you have a WordPress website with images, the answer is most likely yes!
Have you ever tested your website with tools like PageSpeed Insights or GTmetrix and received complaints that the images are not the right size or are too big? Or that you should be using “next gen” images like WebP or AVIF? Or that the website should “defer offscreen images”?
ShortPixel Adaptive Images comes to the rescue and solves the problems with images on your website in no time.
In addition to images, CSS, JS and font files are also minimized and delivered from our global CDN.
What are the benefits?

What are the features?

new! you can now set your custom domain to serve images or JSS/CSS files, e.g. cdn.example.com. Read more here.
new, lightweight, pure JavaScript Adaptive Images Engine (jQuery no longer required)
same visual quality, but smaller images thanks to ShortPixel algorithms
smart cropping – see an example
serve only images of appropriate size, depending on the viewport of the visitor
lazy load support with adjustable threshold; browser native lazy loading support is also available
automatically serves WebP and AVIF images to browsers that support this format. Animated GIFs are also supported and can will converted to animated WebP and animated AVIF!
caching and serving from a global CDN for images as well as CSS, JS and fonts
CSS/JS files are minimized automatically
all major image galleries, sliders and page builders are supported
onboarding wizard with a tool that suggests the best settings for each website
support for low quality image placeholders (LQIP)
support for JPEG, PNG, GIF, TIFF, BMP
no need for a separate AVIF or WebP converter plugin, the original images are automatically converted to WebP or AVIF
adjustable size breakpoints when resizing images
possibility to disable plugin functionality for logged in users
multiple types of exclusions available, including and advanced Image Checker Tool
Easy and Advanced mode for settings with a variety of settings for an increased flexibility of the plugin functionality

Do I need an account to test this plugin?
No, just install it and activate it on your WordPress website. You will then automatically receive 500 MB of CDN traffic every month. That’s about 500 visits/month!
How much does it cost?
When using ShortPixel Adaptive Images, only CDN traffic is counted if you choose to use our CDN. With the free plan, you get 100 credits for image optimization, which is equivalent to 500 MB of CDN traffic or about 500 visits/month. Paid plans start at $4.99 and are available as both one-time and monthly plans.
Even better, if you already use ShortPixel Image Optimizer, you can use the same credits for ShortPixel Adaptive Images!
How does it work?
Different visitors have different devices (laptop, mobile phone, tablet), each with its own screen resolution. ShortPixel AI takes into account the resolution of the device and then provides the right size image for each placeholder.
Let us take a web page with a single image of 640×480 pixels.
When viewed from a laptop, the image retains its 640×480 pixel size, but is optimized and delivered from our CDN.
When the same web page is viewed from a mobile phone, the image (for example) is resized to 300×225 pixels, optimized, and delivered via our CDN.
In this way, neither time nor bandwidth is wasted for visitors.
Other plugins by ShortPixel:

FastPixel Caching – WP Optimization made easy
ShortPixel Image Optimizer – Image optimization & compression for all the images on your website, including WebP & AVIF delivery
Enable Media Replace – Easily replace images or files in Media Library
reGenerate Thumbnails Advanced – Easily regenerate thumbnails
Resize Image After Upload – Automatically resize each uploaded image
WP SVG Images – Secure upload of SVG files to Media Library

Get in touch!

Email https://shortpixel.com/contact
Twitter https://twitter.com/shortpixel

WP CLI commands
Use the following WP CLI commands to clear the CSS cache and the Low Quality Image Placeholders:
wp shortpixel clear_css
wp shortpixel clear_lqips
For developers
If there are main images in the Media Library that end with the usual thumbnail size suffix (e.g. -100×100), please set this in wp-config.php:
define('SPAI_FILENAME_RESOLUTION_UNSAFE', true);

If you need to do post-processing in JavaScript after the image/tag has been updated by ShortPixel AI, you can add a callback like this:
jQuery( document ).ready(function() {
ShortPixelAI.registerCallback('element-updated', function(elm){
// elm is the jQuery object, elm[0] is the tag
console.log("element updated: " + elm.prop('nodeName'));
});
});

To change the original URL of the image that is detected by ShortPixel, use this filter that receives the original URL:
add_filter('shortpixel/ai/originalUrl', 'my_function');

To return your own custom URL for each language domain for the same website (single plugin installation), use this filter:
add_filter(‘shortpixel/ai/cdnUrl’, function($cdn_url) {
switch($_SERVER[‘HTTP_HOST’]) { //this is the domain name without protocol
case ‘mydomain.com’: //that’s your main domain
return “https://images.mydomain.com/spai”;
case 'mydomain.fr': //that's your french language domain
return "https://images.mydomain.fr/spai";

default:
return $cdn_url;
}

});
Sometimes when the option to crop images is enabled, SPAI thinks it is not safe to crop an image, but you want to crop it anyway. Please add this attribute to force cropping:
--> this will completely exclude from processing the image which has this attribute;
--> this will exclude the image from being lazy-loaded by the plugin;
--> this will prevent the image from being resized by the plugin.

For adding custom replacement rules use:
add_filter('shortpixel/ai/customRules', 'my_function');

The function is given an array and should append ShortPixel\AI\TagRule instances to the given array , as in the example below.
A real-world example of custom image attributes, a custom srcset, and a custom JSON data attribute:
add_filter('shortpixel/ai/customRules', 'spai_to_iconic');
function spai_to_iconic($tagRules) {
//lazy-loaded data-iconic-woothumbs-src attribute
$tagRules[] = new ShortPixel\AI\TagRule('img', 'data-iconic-woothumbs-src');
//eager attribute
$tagRules[] = new ShortPixel\AI\TagRule('img', 'data-large_image', false, false, false, false, true);
//lazy srcset style attribute.
$tagRules[] = new ShortPixel\AI\TagRule('img', 'srcset', false, false, false, false, false,
'srcset', 'replace_custom_srcset');
$tagRules[] = new ShortPixel\AI\TagRule('div', 'data-default', 'iconic-woothumbs-all-images-wrap', false, false, false, false,
'srcset', 'replace_custom_json_attr');
return $tagRules;
}

The parameters of the rule are, in this order:
* tagName – the tag name
* attribute to be replaced
* classFilter – only elements having the class, default false
* attrFilter – only elements having the attribute, default false
* attrValFilter only elements having the attribute with the specified value, default false
* mergeAttr – advanced usage (see code), default false
* eager – if true the image is replaced server-side, otherwise is lazy-loaded
* type – advanced usage (see code), default is ‘url’, can also be ‘srcset’ if it has a srcset or json structure
* callback – advanced usage (see code), default false. Needs to be ‘replace_custom_srcset’ if the type is srcset, or ‘replace_custom_json_attr’ if the type is json
* quickMatch – advanced usage (see code), default false
* frontEager -advanced usage (see code), default false
In the same manner if you need a rule to be applied only on the front-end (javascript) you can use the following filter:
add_filter('shortpixel/ai/customFrontendRules', 'my_function');

This rule will only be applied by the New JS Engine (so you need to have the option enabled) and is useful if you have content that is rendered by JavaScript and you need the replacement to be made after the content is rendered.

各版本下載點

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

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


0.8.0 | 0.9.0 | 0.9.1 | 0.9.2 | 0.9.3 | 0.9.4 | 0.9.5 | 0.9.6 | 1.0.0 | 1.0.1 | 1.0.2 | 1.0.3 | 1.1.0 | 1.1.1 | 1.1.2 | 1.1.3 | 1.2.0 | 1.2.1 | 1.2.2 | 1.2.3 | 1.2.4 | 1.2.5 | 1.2.6 | 1.3.0 | 1.3.1 | 1.3.2 | 1.3.3 | 1.3.4 | 1.3.5 | 1.3.6 | 1.4.0 | 1.4.1 | 1.5.0 | 1.5.1 | 1.5.2 | 1.6.0 | 1.6.1 | 1.7.0 | 1.7.1 | 1.7.2 | 1.7.3 | 1.7.4 | 1.7.5 | 1.8.0 | 1.8.1 | 1.8.2 | 1.8.3 | 1.8.4 | 1.8.5 | 1.8.6 | 1.8.7 | 1.8.8 | 1.8.9 | 2.0.0 | 2.0.1 | 2.0.2 | 2.0.3 | 2.0.4 | 2.0.5 | 2.0.6 | 2.0.7 | 2.0.8 | 2.0.9 | 2.1.0 | 2.1.1 | 2.1.2 | 2.1.3 | 2.1.4 | 2.1.5 | 2.1.6 | 2.2.0 | 2.2.1 | 2.2.2 | 2.2.3 | 2.2.4 | 2.3.0 | 2.3.1 | 2.3.2 | 2.3.3 | 3.0.0 | 3.1.0 | 3.1.1 | 3.1.2 | 3.1.3 | 3.2.0 | 3.2.1 | 3.2.2 | 3.3.0 | 3.3.1 | 3.4.0 | 3.4.1 | 3.4.2 | 3.5.0 | 3.5.1 | 3.5.2 | 3.5.3 | 3.5.4 | 3.5.5 | 3.6.0 | 3.6.1 | 3.6.2 | 3.6.3 | 3.7.0 | 3.7.1 | 3.7.2 | 3.7.3 | 3.8.0 | 3.8.1 | 3.8.2 | 3.8.3 | 3.8.4 | 3.9.0 | 3.9.1 | 3.9.2 | 3.9.3 | 3.9.4 | trunk | 2.0.10 | 3.10.0 | 3.10.1 | 3.10.2 | 3.10.3 |

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

  • Smush Image Optimization – Optimize Images | Compress & Lazy Load Images | Convert WebP & AVIF | Image CDN 》Optimize images、啟用 lazy load、調整大小、壓縮以及改善 Google Page 速度,使用由 WPMU DEV 超級團隊齊心研發的強大 WordPress 圖片 Smusher,100% 免費...。
  • EWWW Image Optimizer 》你是否對緩慢的網站感到沮喪?超大的圖片讓你感到 "噁心"?讓 EWWW Image Optimizer 儘可能幫助你的網站加速,提高跳出率並增強 SEO。最重要的是,讓訪客感到...。
  • Converter for Media – Optimize images | Convert WebP & AVIF 》透過使用我們的圖片優化外掛,以 WebP 和 AVIF 圖片來展示,來加速您的網站。將標準 JPEG、PNG 和 GIF 格式的文件替換成 WebP 和 AVIF 格式,可以在不失去品...。
  • WebP Express 》ch means less bandwidth usage and faster page load times., Easy to use - with little effort, WordPress site admins can have their site serving auto...。
  • Modern Image Formats 》外掛介紹:此外掛可在 WordPress 應用程式中增加 WebP 支援,但僅針對新上傳的影像檔案轉換成 WebP 格式,現有檔案不會轉換。預設情況下,WebP 只會針對 JPEG...。
  • Cache Enabler 》Cache Enabler 是個簡單卻強大的 WordPress 快取外掛,使用起來簡單且只需要最小化的設定,最重要的是能夠幫助網站提升效能來達到更快的載入時間。它會將前端...。
  • Optimus – WordPress Image Optimizer 》WordPress圖片優化器, Optimus可自動降低已上傳媒體檔案的檔案大小。根據圖片和格式,可以減少高達70%的大小。每張圖片可以節省數千位元組,這些節省可以對博...。
  • QODE Optimizer 》總結:使用 QODE Optimizer 外掛可以快速且方便地提高網站轉換率和加快載入速度,壓縮、轉換、調整和完全優化網站圖像,操作簡單直觀。, , 問題與答案:, 1. ...。
  • AVIF, WebP Converter 》總結:CompressX 是一個免費的 WebP 和 AVIF 轉換與壓縮 WordPress 網站外掛程式。它可以幫助您將 JPG 和 PNG 圖像輕鬆轉換為 WebP 和 AVIF 格式,並對 WebP ...。
  • WP Enable WebP 》這是一個 WordPress 外掛程式,可以啟用 WebP 圖片上傳到媒體庫。, 同時,外掛會在 body 標籤上新增一個類別,以便使用 CSS 選擇器,方便設定背景圖片。, 例...。
  • Plus WebP or AVIF 》產生 WebP, , 在媒體庫加入圖片檔時,同時產生相對應的 WebP 檔案。, 透過 AJAX 批量製作網站上所有圖片的 WebP 檔案。, 在背景中製作網站上所有圖片的 WebP ...。
  • Images to WebP 》統計顯示,WebP 格式可以在不損失圖像質量的前提下減輕網頁一半以上的負載。, 將 PNG、JPG 和 GIF 圖像轉換為 WebP,加快您的網站速度,減少訪問者下載數據,...。
  • Allow Webp image 》通常 WordPress 不允許使用 ".webp" 格式的媒體檔案,導致上傳時出現錯誤。為了解決此錯誤,您需要安裝這個外掛。啟用外掛後,即可上傳 ".webp" 圖像檔案,加...。
  • Support WebP – Upload webp files in wordpress without hassle 》這個外掛可以讓你在 WordPress 媒體庫中上傳 WebP 格式的圖片,不受佈景主題限制,也就是說它與所有佈景主題都相容。, 查看外掛的 GitHub 存儲庫:Support We...。
  • Bulk images optimizer: Resize, optimize, convert to webp, rename … 》Bulk image resize 可以讓您優化上傳至 WordPress 的圖片。, , 您可以只點擊一次,就可以調整所有圖片的大小。, 它經過優化以加快批量處理的速度。1000 張圖...。

文章
Filter
Apply Filters
Mastodon