Title: Edge Images
Author: Jono Alderson
Published: <strong>2025 年 1 月 6 日</strong>
Last modified: 2025 年 6 月 29 日

---

搜索插件

![](https://ps.w.org/edge-images/assets/banner-772x250.png?rev=3217818)

![](https://ps.w.org/edge-images/assets/icon-256x256.png?rev=3217818)

# Edge Images

 作者：[Jono Alderson](https://profiles.wordpress.org/jonoaldersonwp/)

[下载](https://downloads.wordpress.org/plugin/edge-images.5.5.7.zip)

 * [详情](https://cn.wordpress.org/plugins/edge-images/#description)
 * [评价](https://cn.wordpress.org/plugins/edge-images/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/edge-images/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/edge-images/#developers)

 [支持](https://wordpress.org/support/plugin/edge-images/)

## 描述

Edge Images automatically uses your edge transformation service (e.g., Cloudflare,
Accelerated Domains, Imgix, etc.) to apply performance optimizations to `<img>` 
markup.

⚠️ **Important**: This plugin requires a supported edge provider with image transformation
features enabled (e.g., Cloudflare Pro, BunnyCDN, etc). See the Requirements section
for details.

#### 🚀 Why should I use Edge Images?

 * **Instant Performance Boost**: Automatically optimize and serve images in modern
   formats (WebP/AVIF) through your existing CDN
 * **Zero Configuration**: Works out of the box with your existing images and themes
 * **No Local Processing**: All transformations happen at the edge – no server load
   or storage overhead
 * **Perfectly Sized Images**: Automatically generates the exact image dimensions
   needed for every device and viewport
 * **Cost Effective**: No need for expensive image optimization services or additional
   storage

#### 🎯 Perfect For

 * Sites with lots of images that need optimization
 * Performance-focused developers and site owners
 * Anyone using Cloudflare, BunnyCDN, or similar services
 * Sites that want modern image formats without the complexity
 * Developers tired of managing multiple image sizes

#### 💡 How It Works

WordPress typically creates multiple copies of each uploaded image in different 
sizes. This approach is inefficient and often results in:

 * Images that are too large or small for their display size
 * Unnecessary storage usage
 * Missing sizes for modern responsive designs
 * Lack of modern format support (WebP/AVIF)

Edge Images solves these problems by:

 1. Intercepting image requests
 2. Determining the optimal size and format needed
 3. Using your CDN to transform the image on-demand
 4. Caching the result for future requests

#### ⚡️ Features

**Core Features**

 * Automatic WebP/AVIF conversion
 * Intelligent responsive image handling
 * Smart `srcset` generation
 * Automatic image optimization
 * Optional `<picture>` element wrapping
 * Zero local processing
 * Maintains original images

**Advanced Features**

 * Fine-grained transformation control
 * Multiple CDN provider support
 * Developer-friendly filters
 * Yoast SEO & Rank Math integrations
 * Bricks integration
 * Gutenberg compatibility

#### 🔌 Supported Providers

 * **Cloudflare** (Pro plan or higher)
 * **Accelerated Domains**
 * **BunnyCDN**
 * **Imgix**

#### 🛠️ Technical Example

**Your Code**

    ```
    echo wp_get_attachment_image(1, [640,400], false, ['fit' => 'contain']);
    ```

**What WordPress Usually Outputs**

    ```
    <img width="380" height="400" 
         src="/uploads/2024/11/1.jpg" 
         class="attachment-640x400 size-640x400 wp-image-123" 
         srcset="/uploads/2024/11/1.jpg 400w, /uploads/2024/11/1-285x300.jpg 285w" 
         sizes="(max-width: 640px) 100vw, 640px">
    ```

That’s multiple different images files, none of which are the right size!

**What Edge Images Outputs**

    ```
    <picture class="edge-images-container" style="--max-width: 640px;">
      <img 
           class="attachment-1140x600 size-640x400 wp-image-123 edge-images-processed"
           width="640" height="400" 
           src="/cdn-cgi/image/f=auto,fit=contain,w=640,h=400/uploads/2024/11/1.jpg" 
           srcset="/cdn-cgi/image/f=auto,w=320,h=188/uploads/2024/11/1.jpg 320w,
                   /cdn-cgi/image/f=auto,w=640,h=400/uploads/2024/11/1.jpg 640w,
                   /cdn-cgi/image/f=auto,w=1280,h=800/uploads/2024/11/1.jpg 1280w"
           sizes="(max-width: 640px) 100vw, 640px">
    </picture>
    ```

That’s a range of perfectly sized options for different devices and viewports, automatically
optimized images in modern formats, served from your CDN, futureproofed for supporting
next-generation capabilities, and with no storage overheads.

#### 🎨 Customization

**Transform Parameters**
 Control every aspect of image transformation with attributes
like: * `width`/`height`: Exact dimensions * `fit`: Resizing behavior (contain, 
cover, crop) * `quality`: Compression level * `format`: Output format (auto, webp,
avif)

**Filtering**
 Disable transformations globally or selectively:

    ```
    // Disable all transformations
    add_filter('edge_images_disable', '__return_true');

    // Disable for specific images
    add_filter('edge_images_disable_transform', function($should_disable, $html) {
        if (strpos($html, 'example.jpg') !== false) {
            return true;
        }
        return $should_disable;
    }, 10, 2);

    // Override max width for constrained content
    add_filter('edge_images_max_width', function($max_width) {
        // Example: Use a different max width for single posts
        if (is_single()) {
            return 800;
        }
        return $max_width;
    });

    // Customize srcset width multipliers
    add_filter('edge_images_width_multipliers', function($multipliers) {
        // Add more granular steps between sizes
        return [0.25, 0.5, 0.75, 1, 1.25, 1.5, 2];
    });
    ```

#### 🔧 Requirements

**Essential**

 * A supported edge provider with image transformation features enabled:
    - Cloudflare Pro plan or higher with Image Resizing enabled
    - Accelerated Domains with Image Resizing enabled
    - BunnyCDN with Image Processing enabled
    - Imgix with a configured source

**Technical**

 * PHP 7.4 or higher
 * WordPress 5.9 or higher

#### ✅ Getting Started

 1. Install and activate the plugin
 2. Go to Settings > Edge Images
 3. Select your CDN provider
 4. That’s it! Your images will now be automatically optimized

#### 🤝 Integrations

**Yoast SEO**
 Automatically optimizes images in:

 * Meta tags (og:image, etc.)
 * Schema.org output
 * XML sitemaps

#### 🔒 Privacy

Edge Images processes images through third-party edge providers. Here’s what you
need to know about privacy:

**Data Processing**

 * Images are processed through your chosen edge provider (Cloudflare, Accelerated
   Domains, etc.)
 * No personal data is collected or stored by the plugin itself
 * Image URLs are passed to the edge provider for transformation
 * Original images remain on your server; only public URLs are processed

**Edge Provider Privacy**
 Different providers have different privacy implications:

 * Cloudflare: Images are processed according to [Cloudflare’s Privacy Policy](https://www.cloudflare.com/privacypolicy/)
 * Accelerated Domains: Images are processed according to [Accelerated Domains’ Privacy Policy](https://accelerateddomains.com/privacy/)
 * BunnyCDN: Images are processed according to [BunnyCDN’s Privacy Policy](https://bunny.net/privacy/)

**Data Storage**

 * The plugin stores your selected settings in your WordPress database
 * No user data is collected or stored
 * No analytics or tracking is performed
 * Cache files may be created in your uploads directory for optimization

**GDPR Compliance**

 * The plugin is GDPR-compliant as it does not collect, store, or process personal
   data
 * Users should review their chosen edge provider’s privacy policy and data processing
   terms
 * Site owners should update their privacy policy to reflect their use of third-
   party image processing services

### Development

 * [GitHub Repository](https://github.com/jonoalderson/edge-images)
 * [Report Issues](https://github.com/jonoalderson/edge-images/issues)

## 安装

 1. Upload the plugin files to `/wp-content/plugins/edge-images/`
 2. Activate the plugin through the ‘Plugins’ screen in WordPress
 3. Go to Settings > Edge Images to configure your provider

## 常见问题

### Which edge providers are supported?

Currently supported providers are:

 * Cloudflare (Pro plan or higher required)
 * Accelerated Domains
 * BunnyCDN
 * Imgix

### Do I need to generate different image sizes?

No! The plugin handles image resizing on-the-fly through your edge provider.

### Will this work with my existing images?

Yes, the plugin works with your existing media library images.

### Does this work with Gutenberg?

Yes, the plugin fully supports the WordPress block editor.

### How can I report security bugs?

You can report security bugs through the Patchstack Vulnerability Disclosure Program.
The Patchstack team help validate, triage and handle any security vulnerabilities.
[Report a security vulnerability.](https://patchstack.com/database/wordpress/plugin/edge-images/vdp)

## 评价

![](https://secure.gravatar.com/avatar/7e32eed87123d266aa1f96380a884601dc1f4cb601cb6321149cccc5d1bd2370?
s=60&d=retro&r=g)

### 󠀁[Works great with Accelerated Domains](https://wordpress.org/support/topic/works-great-with-accelerated-domains/)󠁿

 [Andrew Killen](https://profiles.wordpress.org/andrewkillen/) 2025 年 1 月 16 日
1 回复

I’ve tried this out with Accelerated Domains and it works like a charm. Under the
hood the code is really easy to understand and well written. Recommended.

![](https://secure.gravatar.com/avatar/51f55d5974ff861cb88d8b52880f8c15b7f37150ccbad2f47352878a2c9dc2d1?
s=60&d=retro&r=g)

### 󠀁[Smashing](https://wordpress.org/support/topic/smashing-19/)󠁿

 [John Blackbourn](https://profiles.wordpress.org/johnbillion/) 2025 年 1 月 8 日
1 回复

Although this is a new plugin, it’s been developed and tested over several years
and it shows. Dead simple user interface and does exactly what it needs to do with
no fuss.

![](https://secure.gravatar.com/avatar/6845456dbc9056f20a4cd50a6b95db78f2ae31df5c0601c613ee5b8939c41a82?
s=60&d=retro&r=g)

### 󠀁[Just worked](https://wordpress.org/support/topic/just-worked-9/)󠁿

 [Jon Brown](https://profiles.wordpress.org/jb510/) 2025 年 1 月 7 日

Kinda amazing how simply this just works with Cloudflare. Definitely use this if
you have a pro plan.

![](https://secure.gravatar.com/avatar/b1d54d0f922d8cd3efdb4b3d28147055ae6dbae0b57f177d0d51c73bf896ad92?
s=60&d=retro&r=g)

### 󠀁[Faster images what more could you want?](https://wordpress.org/support/topic/faster-images-what-more-could-you-want/)󠁿

 [David Iwanow](https://profiles.wordpress.org/davidiwanow/) 2025 年 1 月 6 日

Simply magic!

![](https://secure.gravatar.com/avatar/9dd81eb4bacf3109475cd6941d21a592e47a206b579a4b567564ceb397385d6f?
s=60&d=retro&r=g)

### 󠀁[Performant images for no effort!](https://wordpress.org/support/topic/performant-images-for-no-effort/)󠁿

 [Tom Anthony](https://profiles.wordpress.org/tomanthony/) 2025 年 1 月 6 日

This is just such an obviously useful plugin for anyone who cares about performance,
and doesn’t want to spend ages fiddling with images.

 [ 阅读所有5条评价 ](https://wordpress.org/support/plugin/edge-images/reviews/)

## 贡献者及开发者

「Edge Images」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Jono Alderson ](https://profiles.wordpress.org/jonoaldersonwp/)

「Edge Images」插件已被翻译至 1 种本地化语言。 感谢[所有译者](https://translate.wordpress.org/projects/wp-plugins/edge-images/contributors)
为本插件所做的贡献。

[帮助将「Edge Images」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/edge-images)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/edge-images/)，查看[SVN仓库](https://plugins.svn.wordpress.org/edge-images/)，
或通过[RSS](https://plugins.trac.wordpress.org/log/edge-images/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/edge-images/)。

## 更新日志

#### 5.5.7 ( 28/06/2025 )

 * BUGFIX: Prevent fatal errors when image_downsize has been filtered.

#### 5.5.6 ( 02/06/2025 )

 * BUGFIX: Prevent the ‘No provider selected’ notice showing up incorrectly.
 * BUGFIX: Tweak CSS containment approach to be more easily overridden.

#### 5.5.4 ( 02/06/2025 )

 * FEATURE: Add content-visibility CSS to containers.
 * FEATURE: Add a ‘edge_src’ function to support direct/manual transformation.
 * BUGFIX: Only show the NGINX config warning on our settings page (and tidy up 
   some variables).

#### 5.5.2 ( 23/04/2025)

 * BUGFIX: Fixed some regex mismatches for images in content blocks.

#### 5.5.1 ( 08/04/2025 )

 * FEATURE: Tested up to WP 6.8.
 * MISC: Tidied up some code.

#### 5.5 ( 10/03/2025)

 * BUGFIX: Prevented a layout-breaking bug for images in content, wrapped in picture
   els.

#### 5.4.2 ( 23/02/2025 )

 * BUGFIX: Prevent local transformations from outputting upscaled srcset values.

#### 5.4 ( 23/02/2025 )

 * FEATURE: Added support for transforming image URLs locally (performance warnings
   apply if you’re using a lot of images and not using a CDN to cache them).

#### 5.3.5 ( 13/02/2025 )

 * BUGFIX: Tweaked the Bricks integration to improve SVG handling.
 * FEATURE: Tweaked classes to make it clear when an image has been skipped.

#### 5.3.0 ( 13/02/2025 )

 * FEATURE: Add Rank Math integration
 * BUGFIX: Fix Bricks integration

#### 5.2.19 ( 12/02/2025 )

 * FEATURE: Add caching to social images in the Yoast SEO integration, and tweak
   how small images are handled.

#### 5.2.18 ( 12/02/2025 )

 * FEATURE: Added an integration for Bricks (which disables transformations for 
   SVGs).
 * FEATURE: Added a filter for controlling the default quality of transformed images.

#### 5.2.17 ( 07/02/2025 )

 * BUGFIX: Fixed a caching bug when updating the plugin.

#### 5.2.15 ( 07/02/2025 )

 * BUGFIX: Fixed a fatal error where an attachment ID was not provided.

#### 5.2.14 ( 05/02/2025 )

 * BUGFIX: Prevented intentionally empty alt attributes from being removed.

#### 5.2.13 ( 04/02/2025 )

 * BUGFIX: Big improvements to consistency of srcset transformation on wp_get_attachment_image_srcset
   and similar.

#### 5.2.12 ( 04/02/2025 )

 * BUGFIX: Fixed a src regreggion bug introduced in 5.2.10.

#### 5.2.11 ( 04/02/2025 )

 * BUGFIX: Fixed a srcset transformation bug introduced in 5.2.10.

#### 5.2.10 ( 04/02/2025 )

 * BUGFIX: Fixed the transformation when wp_get_attachment_url, wp_get_attachment_image_srcset
   or wp_get_attachment_image_sizes were used directly.
 * BUGFIX: Ensured that the cache is cleared when the transformation domain is changed.

#### 5.2.9 ( 30/01/2025 )

 * BUGFIX: Don’t try to transform AVIF images in srcset attributes.
 * BUGFIX: Correctly apply custom rewrite domains to src attributes in some edge
   cases.

#### 5.2.7 ( 16/01/2025 )

 * FEATURE: Added an admin setting for customizing the domain used for transformed
   images.

#### 5.2.6 ( 10/01/2025 )

 * FEATURE: Added a filter for customizing the width multipliers used for generating
   srcset variants (and disabled the 2.5x multiplier by default).
 * FEATURE: Moved CSS to inline styles to avoid extra HTTP requests.

#### 5.2.5 ( 09/01/2025 )

 * BUGFIX: Fixed the XML sitemap integration.

#### 5.2.4 ( 09/01/2025 )

 * BUGFIX: Prevent fatal errors when attachment posts were updated.
 * FEATURE: Disabled ‘gravity’ settings by default.
 * FEATURE: Added some front-end CSS to unbreak the admin bar avatar.
 * FEATURE: Disabled the htaccess cache feature on non-Apache systems.

#### 5.2.3

 * Removed some redundant error logging.
 * Tweaked CSS to ensure correct positioning of SVGs inside picture elements.
 * Added filtering capabilities.
 * Overhauled the readme file.

## 额外信息

 *  版本 **5.5.7**
 *  最后更新：**11 月前**
 *  活跃安装数量 **20+**
 *  WordPress 版本 ** 5.6 或更高版本 **
 *  已测试的最高版本为 **6.8.5**
 *  PHP 版本 ** 7.4 或更高版本 **
 *  语言
 * [Dutch](https://nl.wordpress.org/plugins/edge-images/) 和 [English (US)](https://wordpress.org/plugins/edge-images/).
 *  [翻译成简体中文](https://translate.wordpress.org/projects/wp-plugins/edge-images)
 * 标签
 * [cdn](https://cn.wordpress.org/plugins/tags/cdn/)[cloudflare](https://cn.wordpress.org/plugins/tags/cloudflare/)
   [images](https://cn.wordpress.org/plugins/tags/images/)[optimization](https://cn.wordpress.org/plugins/tags/optimization/)
   [performance](https://cn.wordpress.org/plugins/tags/performance/)
 *  [高级视图](https://cn.wordpress.org/plugins/edge-images/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  5 条 5 星评价     ](https://wordpress.org/support/plugin/edge-images/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/edge-images/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/edge-images/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/edge-images/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/edge-images/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/edge-images/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/edge-images/reviews/)

## 贡献者

 *   [ Jono Alderson ](https://profiles.wordpress.org/jonoaldersonwp/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/edge-images/)