=== ProductImageUpscale – AI Image Upscaler ===
Contributors: puskalkafle
Tags: image upscaler, woocommerce, product images, media library, image enhancement
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Upscale product images directly from the WordPress Media Library and WooCommerce product editor using AI. Supports 2x, 4x, and 8x enlargement.

== Description ==

Product Image Upscale connects your WordPress site to the [productimageupscale.com](https://www.productimageupscale.com) service, letting you upscale images at 2x, 4x, or 8x directly from the Media Library, the WooCommerce Product Edit screen, or the WooCommerce Products catalog list. 

Whether you are running an active WooCommerce store or any WordPress site that needs crystal-clear, high-resolution imagery, this plugin makes it effortless to enhance your visual assets without leaving your dashboard.

When you click "Upscale", the plugin sends the image to the Product Image Upscale API, which enhances texture, edges, and fine details using AI. For maximum flexibility, you can choose to automatically replace original files or safely duplicate upscaled versions as new media attachments.

= Features =

* **Deep WooCommerce Integration** — Dedicated AI Image Upscaler meta box directly inside the WooCommerce Product Edit screen.
* **Global WooCommerce Products Bulk Action** — Upscale images across multiple selected products from the main Products list with an interactive Dark Glassmorphic modal.
* **WooCommerce Action Scheduler Support** — Queue large catalog batches to process asynchronously in the background with admin notice feedback.
* **Safe Duplication Mode** — Generate upscaled images as new media attachments without overwriting original files.
* **"Set as Main Product Image" Star Toggle** — Quickly assign an upscaled photo as the product's primary featured image.
* **One-click upscale** — Enhance any image from the Media Library list view, the attachment edit screen, or the product editor.
* **Batch processing** — Upscale all product gallery images at once from the product editor with a live progress bar.
* **Multiple scale factors** — Choose 2x, 4x, or 8x per image or set a default.
* **Material-aware processing** — Optional texture modes (Model, Fabric, Leather) for specialized e-commerce photography.
* **Automatic thumbnail regeneration** — Replaces or duplicates images and automatically regenerates all required WordPress thumbnail sizes.
* **Status indicators & Low-Res Warning** — Instantly identify low-resolution images (< 1000px) and track which images are already upscaled.

= How It Works =

1. Install the plugin and enter your API key from [productimageupscale.com](https://www.productimageupscale.com).
2. **From WooCommerce Product Edit:** Edit any product, scroll down to the "AI Product Image Upscaler" meta box, and upscale individual images or batch process them all at once.
3. **From WooCommerce Products List:** Select multiple products, choose "Upscale Images with AI" from Bulk Actions, review the scanned image breakdown in the modal, and upscale live or queue in the background.
4. **From the Media Library:** Navigate to Media, click "Upscale" on any image or use Bulk Actions.
5. The plugin sends the image to the API, receives the enhanced version, and depending on your settings, either replaces the original file or safely duplicates it as a new media attachment.

= Third-Party Service =

This plugin relies on the **Product Image Upscale** external service to process images.

When you click "Upscale", the following data is sent to the Product Image Upscale API:

* The public URL or uploaded image file
* Your selected upscale factor (2x, 4x, or 8x)
* Your selected texture type (Model, Fabric, Leather, or None)

Data is sent only when a site administrator explicitly triggers an upscale action. No data is sent automatically or in the background without user initiation.

* **Service website:** [https://www.productimageupscale.com](https://www.productimageupscale.com)
* **Terms of Service:** [https://www.productimageupscale.com/terms](https://www.productimageupscale.com/terms)
* **Privacy Policy:** [https://www.productimageupscale.com/privacy](https://www.productimageupscale.com/privacy)

**Requirements:**

* An active account at [productimageupscale.com](https://www.productimageupscale.com)
* A valid API key (available from the Integrations page in your dashboard)

== Installation ==

1. Upload the `product-image-upscale` folder to the `/wp-content/plugins/` directory, or install the plugin through the WordPress Plugins screen.
2. Activate the plugin through the "Plugins" screen in WordPress.
3. Go to **Media > Product Image Upscale** to enter your API key.
4. Start upscaling images from your Media Library or WooCommerce Products.

== Frequently Asked Questions ==

= Where do I get an API key? =

Sign up at [productimageupscale.com](https://www.productimageupscale.com), then visit the Integrations page in your dashboard to generate an API key.

= What image formats are supported? =

JPEG, PNG, and WebP images are supported. Images must be under 50 MB. There is no dimension limit — larger images are automatically resized to the optimal size before upscaling.

= Does upscaling replace the original image? =

You can choose! With Safe Duplication enabled (default), the plugin generates a new enhanced media attachment while preserving your original file intact. If Safe Duplication is turned off, the original file is replaced and all WordPress thumbnails are automatically regenerated.

= Can I upscale multiple products from the WooCommerce Products list? =

Yes! Select the products from the WooCommerce Products list, choose "Upscale Images with AI" from the Bulk Actions menu, and click Apply. An interactive modal will scan all product images and allow you to upscale them live in-browser or queue them in the background via WooCommerce Action Scheduler.

= What upscale factors are available? =

You can upscale images by 2x, 4x, or 8x. For example, a 400x400 image becomes 3200x3200 at 8x.

= What if processing takes a long time? =

The plugin polls the API for up to 90 seconds. If processing takes longer, refresh the page later to check the status. For large product batches, use "Queue in Background" to process via Action Scheduler.

== Screenshots ==

1. Settings page with API key configuration.
2. Media Library with one-click upscale button and status indicators.
3. Single attachment edit screen with upscale controls in the sidebar.
4. WooCommerce Product Edit screen with AI Product Image Upscaler meta box, image cards, and Safe Duplication toggle.
5. Interactive Bulk Upscale Modal on the WooCommerce Products list view with batch scanning, filter options, and live progress bar.
6. WooCommerce Products list view with 'Upscale Images with AI' bulk action.

== Changelog ==

= 1.0.5 =
* Feature: Global Bulk Upscale action on WooCommerce Products list view with interactive Dark Glassmorphic modal.
* Feature: Automatic product image scanning with low-resolution detection (< 1000px) and already-upscaled indicators.
* Feature: WooCommerce Action Scheduler background queueing support with staggered batch dispatching and admin notice feedback.
* Improvement: Single selection star toggle for setting product primary/featured image.
* Improvement: Safe Duplication mode enhancements with non-destructive gallery preservation.
* Improvement: Added execution time limit protection for long-running batch requests.
* Fix: Prevented card header badge wrapping and cleaned up card visual hierarchy.
* Fix: Synchronized background queue parameters with UI checkbox selections.

= 1.0.4 =
* Feature: Added dedicated AI Product Image Upscaler meta box to the WooCommerce Product Edit screen.
* Feature: View all product primary and gallery images with dimensions, file sizes, and low-resolution (< 1000px) alerts.
* Feature: Safe Duplication mode — upscaled images can be generated as new media attachments without overwriting original files.
* Feature: "Set as Main Product Image" toggle to automatically update the product's featured image upon upscale.
* Feature: Batch processing directly inside the WooCommerce product editor with live progress indicator.
* Improvement: Conditional WooCommerce loading ensures complete backward compatibility for non-WooCommerce WordPress sites.

= 1.0.3 =
* Fix: Added format validation to prevent upscaling unsupported GIF images.
* Improvement: Displays a clear "GIF not supported" badge in the WordPress Media Library list and meta box.
* Fix: Automatically skips GIF images during bulk upscale operations.

= 1.0.2 =
* Improvement: Images are now uploaded directly to the upscaling service instead of being fetched by URL. This fixes failed upscales on sites whose firewall or CDN (e.g. Cloudflare bot protection) blocks external servers from downloading images.
* Improvement: Clearer error message when a site's firewall blocks the image download.

= 1.0.1 =
* Fix: Removed 1600px dimension limit constraint for upscaling.

= 1.0.0 =
* Initial release.
* One-click and bulk upscaling from the Media Library.
* Configurable upscale factor (2x, 4x, 8x).
* Material-aware texture selection for product photography.
* Automatic file replacement with thumbnail regeneration.

== Upgrade Notice ==

= 1.0.5 =
Adds Global WooCommerce Bulk Upscale modal, Action Scheduler background queueing, and enhanced Safe Duplication. Highly recommended for all WooCommerce store owners.

= 1.0.4 =
Adds WooCommerce Product Edit meta box, non-destructive image duplication, and batch product image upscaling. Recommended for all users.

= 1.0.3 =
Prevents attempting to upscale unsupported GIF files and displays clear status indicators in the Media Library. Recommended for all users.

= 1.0.2 =
Fixes failed upscales on sites behind Cloudflare or other firewalls — images are now uploaded directly instead of fetched by URL. Recommended for all users.

= 1.0.0 =
Initial release.
