| 开发者 | imageresizer |
|---|---|
| 更新时间 | 2026年8月17日 15:04 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
upload.php), the Add New Media screen, the "Add Media" dialog and Media Library popup, and inline uploads in the block (post/page) editor — drag-and-drop, paste, and the block "Upload" button.
Everywhere the block editor runs is covered, so that also includes the Site Editor on a block theme and the block widgets screen on a classic one.
Programmatic / REST / WP-CLI / FTP uploads cannot be processed by any client-side tool, including this one.
About ImageResizer.cc
This plugin is made by the team behind ImageResizer.cc — a free, privacy-first online tool to resize, compress and convert images entirely in the browser. The plugin brings that same engine straight into your WordPress upload flow.
Working outside WordPress? The web app handles the same jobs with no install: compress an image to a target size, convert HEIC to JPG, or convert PNG to WebP — all client-side, nothing uploaded, no account.
Source code
Nothing in this plugin is obfuscated. The files under build/ are minified for delivery only. The complete, un-minified sources that produce them ship inside the plugin, and the same tree is public at
https://github.com/AlexStack/imreso-target-size-image-compressor
What ships:
src-js/ — every TypeScript/JavaScript source file (worker engine, main-thread client, uploader interceptors, format sniffer). build/ir-worker.js, build/worker-client.js, build/classic-uploader.js and build/block-uploader.js are built from these.build.mjs — the esbuild configuration that bundles src-js/ into build/.package.json — declares the third-party packages listed below. The versions the shipped build/ was produced from are recorded in licenses/README.txt.build/chunks/ holds the lazily loaded pieces esbuild split out. They are minified derivatives, not verbatim copies, and they come from three places:
encode-*.js, avif_enc-*.js, webp_enc-*.js and webp_enc_simd-*.js are the @jsquash codecs; UTIF-*.js is utif2 (which bundles pako); heic-to-*.js is heic-to, and at ~3 MB it is the largest file in the plugin — it is libheif compiled to plain JavaScript, so HEIC decoding needs no extra binary. The readable originals are the npm packages listed under "Third-party libraries" below, reproduced verbatim by npm install; their full licence texts ship in licenses/.chunk-*.js is built from src-js/wfd-shim.js.chunk-*.js carrying esbuild's own CommonJS interop runtime, and avif_enc_mt-*.js, a one-line stub build.mjs substitutes for the multi-threaded AVIF codec so it is never bundled.build/ from those sources, run this from the plugin folder:
npm install && npm run build
The rebuilt build/ is functionally identical. The four .wasm codecs and the four top-level bundles come out byte-for-byte the same. The lazily loaded files under build/chunks/ carry an esbuild content hash in their filename (heic-to-<hash>.js); that hash is derived from the chunk's contents, so it moves whenever a dependency version does, and the import statements in ir-worker.js move with it. The chunk contents are unchanged and each build/ is internally consistent. The hash is what stops browsers serving a stale chunk after a plugin update.
The .wasm files
build/ contains four WebAssembly binaries. They are the image encoders themselves — the plugin exists to compress images on the user's own device instead of on a server or an external API, and these are what performs that encoding. Without them the plugin has no function at all.
They are the stock, unmodified binaries published by the @jsquash packages: npm install fetches byte-identical files and build.mjs copies them next to the bundle. Nothing is fetched at runtime — they are loaded from the plugin folder, which is what keeps every image on the user's own device.
Each is compiled from a public, GPL-compatible upstream C/C++ project:
webp_enc.wasm, webp_enc_simd.wasm — libwebp (BSD-3-Clause) — https://chromium.googlesource.com/webm/libwebpmozjpeg_enc.wasm — mozjpeg (BSD-3-Clause / IJG) — https://github.com/mozilla/mozjpegavif_enc.wasm — libavif (BSD-2-Clause) — https://github.com/AOMediaCodec/libavif — with libaom — https://aomedia.googlesource.com/aomlicenses/ directory, with the exact bundled versions; upstream sources are linked below.
imreso-target-size-image-compressor folder to /wp-content/plugins/, or install the .zip via Plugins → Add New → Upload Plugin.Yes. Select as many images as you like in the Media Library or "Add Media" dialog and each one is resized and compressed in your browser before upload. There is no per-image limit and nothing is queued on a server.
Yes. Set the "Max compress size" in the ImReso menu (default 500 KB) and the plugin searches the encoder quality so each image lands at about that size. Set it to 0 to use a fixed Quality value instead.
Yes — that is the whole point. All processing happens in your browser, so the free plugin makes zero external network requests. Your images are never sent to our servers or anyone else's.
No. It is genuinely unlimited — there is nothing to meter because the work runs on your own device.
It reads JPEG, PNG, WebP, AVIF, BMP, TIFF and HEIC/HEIF, and outputs WebP, AVIF or JPEG. GIF (animated or not), SVG, ICO and JPEG 2000 are left untouched and uploaded as-is.
Yes. HEIC/HEIF images are decoded and converted to WebP, AVIF or JPEG entirely in your browser, so they're viewable everywhere, and it is the converted file that gets stored — WordPress never sees the HEIC.
The conversion needs JavaScript. If it cannot run, the plugin steps aside and the browser posts the original file; the plugin allows .heic/.heif through the upload filter so that attempt is not blocked, but whether a raw HEIC is accepted and thumbnailed after that is up to your server's image library, and many do not support it.
Not yet. This release resizes and compresses new uploads. Bulk optimization of the existing library is planned for a later release.
AVIF encoding is CPU-heavy. On mobile devices the plugin automatically prefers WebP for reliability. You can also fix the format to WebP in the ImReso menu.
No — images still compress, and you can confirm it from the savings figures. Some hosts (a few nginx setups in particular) do not yet map the .wasm extension to the application/wasm content type. When that happens the browser refuses to compile the codec while it downloads and falls back to loading it into memory first, which is a little slower on the very first image of a page and logs that message. The codecs are read from this plugin's own folder either way; nothing is fetched from anywhere else. Adding application/wasm wasm; to your server's mime types removes the message.
The original file is uploaded unchanged. Compression never blocks or breaks an upload.
Yes. Updates are delivered by WordPress.org like any other plugin from the directory — you will see them on the Plugins screen, and you can switch on "Enable auto-updates" there to have them installed for you. The plugin ships no updater of its own and contacts no server to check for updates.
Every string in the interface is translatable, and translations are delivered by WordPress itself: once your site's locale has been translated on translate.wordpress.org, WordPress installs and updates the language pack for you, with no action needed here. Contributions for any locale are welcome there — the project page is linked from this plugin's page in the plugin directory.
build/README.txt: a plain-text manifest naming the source of every generated file, so the origin of anything under build/ can be read without leaving that directory.