| 开发者 | kitgenix |
|---|---|
| 更新时间 | 2026年10月14日 01:51 |
| 捐献地址: | 去捐款 |
| PHP版本: | 8.1 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv3 or later |
| 版权网址: | 版权信息 |
WP_Image_Editor layer using the image library available on the server, normally GD or Imagick. New uploads can be optimized automatically, while existing media can be processed through a persistent background queue or WP-CLI.
The plugin is designed for WordPress sites and WooCommerce stores that want image compression, size reduction and modern-format delivery without per-image credits or an external image-processing account.
Learn more about Kitgenix at Kitgenix.
WordPress Image Optimization Features
big_image_size_threshold behaviour.<picture> delivery when corresponding sidecars exist.loading attribute management for frontend images..webp and .avif sidecars can be generated alongside the original file. The original source remains the fallback.
When sidecar delivery is enabled and the corresponding sidecar files exist, frontend image markup can be wrapped in a <picture> element containing AVIF and/or WebP <source> elements. AVIF is placed before WebP where both are available so a capable browser can choose the first supported modern format.
The delivery logic only rewrites images that resolve within the site's WordPress uploads directory. Remote images are not rewritten as if local sidecar files existed.
Resizing Oversized Images
Configured maximum dimensions integrate with WordPress's big-image threshold so the site does not unnecessarily perform one resize in WordPress core and a second independent resize in the plugin.
The optimizer preserves aspect ratio and relies on the active WordPress image editor for the actual image operation.
Metadata Stripping
Optional metadata stripping can remove image metadata during processing where supported by the active editor. This can reduce file size and may remove embedded EXIF/GPS information from images that are rewritten.
Because metadata requirements differ between sites, administrators should keep this disabled if they need embedded camera/copyright/location metadata to remain in optimized derivatives.
Backups and Restore
If Backup Originals is enabled before optimization, the plugin can retain an original backup file. A per-image restore action and WP-CLI restore command can put that backup back in place.
Restoring a master image regenerates WordPress attachment metadata and sub-sizes so the database dimensions and generated files stay aligned with the restored source.
Backup deletion on uninstall is separately configurable. Media Library originals are never treated as disposable plugin settings data.
Bulk Optimization Queue
Large libraries are handled through persisted queue state rather than one giant admin request. The queue can be started in normal bulk mode or re-optimization mode, paused, resumed, stopped and asked to retry failed items.
A scheduled background runner continues processing queue batches after the administrator leaves the page. The admin interface can poll queue status and display processed/failed counts without requiring one PHP request to remain open for the entire library.
Exclusion Rules
The code includes exclusions for:
loading attributes to <img> elements that do not already declare one. The first image is left eager to avoid automatically delaying the likely Largest Contentful Paint candidate, while later images can receive loading="lazy".
The lazy-loading processor skips admin and other unsuitable contexts and does not overwrite an existing loading attribute.
Media Library and Attachment Tools
The Media Library receives optimization status/savings information and per-image controls. An attachment panel provides additional context for a selected image, and administrators can trigger single-image optimization or restore where permitted.
AJAX actions require both the plugin-level media capability and permission to edit the individual attachment.
Diagnostics and Site Health
Diagnostics report GD/Imagick availability and versions, preferred WordPress image editor, PHP memory information and encode/decode support for relevant formats. Site Health exposes the same capability picture and can warn when a feature such as WebP/AVIF conversion is enabled but the server cannot perform that conversion.
Optimization failure counts and queue status are also available for troubleshooting.
REST API
The plugin registers authenticated/read-only diagnostic routes under:
kitgenix-image-optimizer/v1
Routes provide status and capability information. They are intended for administration/diagnostics rather than remote image upload or third-party compression.
WP-CLI
The command base is:
wp kitgenix-optimizer
The code includes commands for server/queue status, optimizing all eligible images or a single attachment, forced re-optimization, statistics, backup restore and queue actions (start, pause, resume, stop, retry, status).
Privacy and Storage
Images are processed locally. Plugin settings, queue state, statistics, logs and per-image optimization metadata are stored in WordPress. Optional backup and sidecar files are stored in the site's uploads area.
The shared Kitgenix admin Hub can request public plugin-directory data from WordPress.org, and the admin stylesheet imports disclosed Google Fonts. Neither service receives image files for optimization.
Typical Uses
No. Processing is local through WordPress WP_Image_Editor. See External Services for non-image admin requests.
Yes. The queue supports optimization, re-optimization, pause/resume, and failed-item retry. Restore is available when Backup Originals was enabled before optimization.
wp_image_editor_supports() capability checks, preventing unsupported conversion settings from appearing on servers that cannot encode the selected format.wp kitgenix-optimizer status WP-CLI command for displaying the current Image Optimizer status.wp kitgenix-optimizer queue start, pause, resume, stop, retry, and status WP-CLI commands for managing the bulk optimisation queue.wp_generate_attachment_metadata after WordPress has generated registered image sub-sizes and applied big_image_size_threshold, instead of processing the raw upload before WordPress core.big_image_size_threshold filter so oversized images are resized once instead of being independently resized by both WordPress and the plugin.strip_meta(). Previously the option had no effect when Imagick was the active image editor, leaving EXIF and GPS metadata intact despite the setting being enabled.edit_post capability for the specific attachment in addition to the general upload_files capability, preventing contributor-level users from optimising or restoring attachments they do not have permission to edit.memory_limit, allowing malformed or decompression-bomb-style files to be rejected before GD or Imagick attempts to decode them.kitgenix-admin-components.js component controller providing reusable toast notifications, modals, collapsible cards, copy-to-clipboard controls, and live table filtering for consistent behaviour across Kitgenix plugins.