Linux 软件免费装
Banner图

External Image Importer - Import Remote Images to the Media Library

开发者 nerdcow
更新时间 2026年7月11日 20:02
PHP版本: 7.4 及以上
WordPress版本: 7.0
版权: GPLv2 or later
版权网址: 版权信息

标签

migration media library import images external images remote images

下载

1.0.1

详情介绍:

External Image Importer automatically uploads externally-hosted images to your Media Library when you paste external content into the WordPress editor, then rewrites every URL to point at your own local copy. It is built SSRF-safe: every remote fetch is validated and hardened before the file is downloaded. Remove the hassle of importing external images by hand when you: The dev-to-live problem this solves When you copy or migrate WordPress content between environments - for example from a dev or staging site to your live site - images embedded in that content stay hotlinked to the source domain. The block HTML (or pasted classic-editor markup) keeps pointing at https://dev.example.com/..., so your production pages silently load images from staging. If the source environment is private, password-protected or taken down after launch, those images break. This plugin fixes that automatically: it finds the external image URLs, pulls the files into your own Media Library, and updates the content so everything is served from your own domain. Key features Security Server-side remote fetching is handled with defence in depth: How it works Paste your content as you normally would, then Publish or Save. When you do, the plugin scans the content for externally-hosted images, securely downloads each one into your Media Library, and rewrites the markup to your local copy at the same size it referenced, so your layout is unchanged. What it scans Compatibility Privacy and external connections This plugin does not phone home and does not send your data to any third party. There are no analytics, no tracking and no external API calls. The only outbound requests it makes are to the image URLs that already appear in your own content, purely to download those images into your Media Library. Nothing about your site, content or visitors is transmitted anywhere else.

安装:

  1. Upload the nerdcow-external-image-importer folder to wp-content/plugins/, or install the plugin through the Plugins > Add New screen.
  2. Activate the plugin through the Plugins screen in WordPress.
  3. That is it - no configuration is required. External images are imported automatically the next time you save a post or page.
  4. (Optional) To fix content saved before activation, run the WP-CLI command: wp auei localise --dry-run to preview, then wp auei localise to apply.

升级注意事项:

1.0.1 Skips re-uploading images that already exist in your Media Library (matched by exact filename), avoiding duplicates when migrating content. 1.0.0 Initial release of External Image Importer.

常见问题:

Will it ever replace a working image with a broken one?

No - this is a core safety behaviour. Every download is verified to be a genuine, decodable image of the expected MIME type before any URL is rewritten. If the downloaded file is not a real image (for example a geo-blocked placeholder page or an error document), it is discarded and your original external URL is left exactly as it was. A broken local copy is never put in place of a URL that was working.

Does it work with the Block editor and the Classic editor?

Yes. A single save hook (wp_insert_post_data) covers both the Block (Gutenberg) editor - which saves via the REST API - and the Classic editor.

Does it work on multisite?

Yes. It runs per site, so each site's external images are imported into that site's own Media Library.

What happens to alt text and captions?

They are preserved. The plugin only rewrites image URLs and remaps the attachment ID stored in Gutenberg blocks; it does not touch your alt text, captions or any other attributes.

Which image formats are supported?

JPEG, PNG, GIF, WebP, AVIF and BMP. SVG and ICO are excluded by default for security (SVG can embed script, and ICO is a common smuggling vector). If you fully trust your sources you can extend the allowed set via the auei_allowed_extensions filter, but doing so is at your own risk.

Does it send my data anywhere?

No. The plugin uses no external services and contains no tracking or analytics. The only outbound HTTP requests it makes are to the image URLs that already exist in your own content, purely to download those images into your local Media Library.

Which image size does it import, and what happens to the block in the editor?

It imports the full-size original. WordPress content usually references a scaled image (for example photo-1024x670.webp); the plugin strips that -WxH suffix, fetches the full original, and lets WordPress regenerate every registered size locally - so you have the thumbnail, medium, large and full versions, just like a normal upload. The image in your content is then rewritten to the local copy at the same size it referenced, so the layout is unchanged. It also remaps the attachment ID stored in the block ("id":N / wp-image-N) to the new local attachment, so the editor's image controls keep working and no stale or colliding source ID is left behind. Both behaviours can be turned off with the auei_import_full_size and auei_remap_ids filters.

Will it re-download images it has already imported?

No. Before downloading, the plugin checks whether the image already exists in your Media Library and reuses it:

  1. by the exact remote source URL it previously imported (stored in _auei_source_url post meta); and
  2. by exact filename against your whole Media Library, including images you uploaded normally, not just ones this plugin imported.
Point 2 is the important one for the dev-to-live workflow: if the destination already has the images (for example the page was partly built on live before), they are reused instead of re-uploaded as duplicates. Matching is on the exact stored-file basename, and only when a single unambiguous match exists, so an unrelated image is never picked. Turn filename reuse off with the auei_reuse_by_filename filter if you prefer always-fresh imports.

How do I keep images from a trusted CDN or partner as external?

Add the domain to the whitelist with the auei_whitelisted_domains filter. Whitelisted domains are never imported and their URLs are left untouched.

Is it safe to run on a server behind a private network?

Yes - that is a core design goal. The built-in SSRF guard blocks requests to private, reserved, loopback, link-local, ULA and CGNAT addresses, plus the cloud metadata endpoint, and requires every resolved IP of a host to be public before any fetch happens.

更新日志:

1.0.1 1.0.0