=== WMX Pull Product Images ===
Contributors: webmatrix
Tags: woocommerce, product images, media library, image import, product gallery
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.5.17
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fetch a supplier's product images from a URL into your WooCommerce product gallery, no manual downloading, uploading, or renaming.

== Description ==

Paste a supplier's product-page URL on the WooCommerce product edit screen, tick the images you want, and pull them into the Media Library and your product gallery, no manual downloading, uploading, or renaming.

**Free**

* A "Pull product images" box on the classic WooCommerce product editor.
* Fetch every image from a supplier's product page by pasting its URL.
* Resolves thumbnail and resize variants back to the original, full-resolution file (WordPress, Shopify, Magento, BigCommerce, imgix / Squarespace).
* Shows each image's real dimensions (read from the file header) so you can judge quality before importing.
* Hides obvious logos, icons and page junk automatically.
* Preview and hand-pick the images you want, then import them into the product gallery.
* Preserves the supplier's alt text.
* Safe re-imports: an image already in your Media Library is reused, never downloaded twice.
* If a page can't be fetched (e.g. a bot challenge), paste its page source and the same detection runs on it.

**Pro**

Upgrade to Pro (through wmxsoft.com) for the power features:

* Automatically set the featured image from your first pick.
* Replace-gallery mode and finer gallery controls.
* Filter images by size with an interactive slider (for large galleries), plus a configurable minimum size.
* One-click "select all", drag-to-select a group of images, and rename files to the product slug on import.
* Remember your preferences between imports.

**How it works**

1. Edit or add a product. The "Pull product images" box appears below the editor.
2. Paste the supplier's product page URL and click Fetch images.
3. Pick the images you want and click Import selected, and they are added to the product gallery.
4. Click Update or Publish to save the gallery with the product.

The page is fetched server-side and parsed for og:image, JSON-LD, itemprop/image_src meta, preload links, img/srcset/picture, lazy-load templates, image-bearing data-* attributes, inline CSS backgrounds, lightbox links, and gallery JSON embedded in scripts (Magento, BigCommerce, Squarespace, Vue/React apps). Galleries that are built entirely in the browser after page load, with no image URLs in the HTML source, cannot be seen.

**External services**

When you use the image tools, the plugin makes outbound HTTP requests from **your** web server to two things, only when you ask it to:

* the supplier product-page URL you paste (to read the page and find images), and
* the image URLs on that page (to read dimensions and to download the images you select).

WordPress's safe HTTP layer blocks requests to private/internal hosts, including on redirects. Make sure you are entitled to use the supplier's imagery on your store.

The plugin uses the Freemius service for the Pro upgrade and, in the Pro version, to deliver updates and validate licences. It may contact api.freemius.com with basic environment information (such as site URL and plugin/WordPress versions); the Pro version additionally sends your licence key. See the Freemius Terms (https://freemius.com/terms/) and Privacy Policy (https://freemius.com/privacy/).

== Installation ==

1. In wp-admin go to Plugins > Add New, search for "WMX Pull Product Images", then Install and Activate. Or upload the plugin ZIP via Plugins > Add New > Upload Plugin, or copy the `wmx-pull-product-images` folder into `wp-content/plugins/`.
2. Activate the plugin. WooCommerce must be active.
3. (Pro, optional) Set the minimum image width and height under Settings > Pull Product Images (default 400 x 400).

== Frequently Asked Questions ==

= What's the difference between Free and Pro? =

Free fetches a supplier's images, resolves them to full resolution, shows their dimensions, hides obvious junk, and lets you hand-pick and import them into the product gallery. Pro adds automation and scale: auto-set featured image, replace-gallery mode, filter and sort by dimensions, select-all, rename on import, and remembered preferences.

= Does it work with the new block-based product editor? =

It targets the classic WooCommerce product editor (the one WPBakery runs alongside). It does not target the block-based product editor.

= A supplier page returns no images. Why? =

Some sites build their gallery in the browser from a separate API call after the page loads, leaving no image URLs in the HTML source; those cannot be detected. The page is also fetched by your server (not your browser), so sites behind a Cloudflare (or similar) bot challenge that requires JavaScript cannot be fetched at all. Developers can adjust the outgoing request with the `wmxppi_user_agent` and `wmxppi_http_args` filters.

When a page can't be fetched, use **Paste page source**: open the page in your own browser (which passes the challenge), view its source, copy it, and paste it into the box that appears, and the same image detection then runs on the pasted HTML.

= Which image types are supported? =

JPEG, PNG, WebP, and AVIF, up to 25 MB each.

= Will it re-download images I already imported? =

No. Each attachment stores its source URL, so an image already in the Media Library is reused instead of downloaded again.

= Are there hooks for developers? =

Yes:

* `wmxppi_images` ( array $images, string $url, string $source, int $post_id ) - filter candidates before they are shown.
* `wmxppi_http_args` ( array $args, string $accept ) - adjust the page request.
* `wmxppi_user_agent` ( string $user_agent ) - change the User-Agent used to fetch pages and images.
* `wmxppi_min_size` ( array { min_width, min_height } ) - override the saved minimum size (Pro).
* `wmxppi_max_images` ( int $max ) - default 80.

== Screenshots ==

1. After fetching images from a supplier URL, pick the ones you want. Each tile shows its real dimensions, and obvious logos, icons and page junk are hidden.
2. The picked images imported straight into the WooCommerce product gallery, ready to publish.

== Changelog ==

= 1.5.17 =
* Minor internal tidy-ups.

= 1.5.16 =
* Code tidy-up for the WordPress.org review. No change to how the plugin works.

= 1.5.15 =
* Internal names now use the `wmxppi` prefix. If you hooked the plugin's filters, switch to the new `wmxppi_*` names.

= 1.5.14 =
* The free version now contains only the free features. Pro features come with the Pro version, which the plugin offers to install when you upgrade.

= 1.4.13 =
* Copies of the free version downloaded from wmxsoft.com now update in wp-admin.

= 1.3.12 =
* Housekeeping. No functional change.

= 1.3.11 =
* Housekeeping. No functional change.

= 1.3.10 =
* Better junk filtering: automatically hides more non-product images, including wordmark logos, banners, section backgrounds, app-store badges and tiny icons.
* Minor internal tidy-ups.

= 1.2.9 =
* Fixed: on the free version, importing no longer sets the product's featured image. Auto-setting the featured image remains a Pro feature.

= 1.2.8 =
WMX Pull Product Images is now freemium: a free tier, plus a Pro upgrade through wmxsoft.com. Here is what it does today.

Free:
* Adds a "Pull product images" box to the classic WooCommerce product editor.
* Paste a supplier's product-page URL and fetch every image on the page.
* Resolves thumbnails and resized copies back to the original, full-resolution file (WordPress, Shopify, Magento, BigCommerce, imgix / Squarespace).
* Reads each image's real dimensions from the file header, so you can judge quality before importing.
* Hides obvious logos, icons, and page junk.
* Hand-pick the images you want and import them straight into the product gallery.
* Reuses an image already in your Media Library instead of downloading it twice, and preserves the supplier's alt text.
* If a page can't be fetched (for example, a bot challenge), paste its source and the same detection runs on it.

Pro (through wmxsoft.com):
* Auto-set the featured image from your first pick.
* Replace-gallery mode and finer gallery controls.
* Filter and sort images by size with an interactive slider, plus a configurable minimum size.
* One-click select-all, drag-to-select, and rename files to the product slug on import.
* Remembers your preferences between imports.

Recent updates also added the plugin icon and tidied the settings screen.

= 1.0.1 =
* Initial WEB MATRIX release candidate: fetch supplier product images from a URL and import them as the featured image and gallery; real dimension probing; configurable minimum size; safe re-imports; settings-only uninstall.
