=== 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.4
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 or the WooCommerce Product Edit screen. 

Whether you are running a WooCommerce store or any WordPress site that needs higher-resolution images, this plugin makes it incredibly easy 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 processes it and returns an enhanced version. For maximum flexibility, you can choose to automatically replace the original file, or safely duplicate the upscaled image as a new media attachment.

= Features =

* **Deep WooCommerce Integration** — Dedicated AI Image Upscaler meta box directly inside the WooCommerce Product Edit screen.
* **Safe Duplication Mode** — Upscale images as new media attachments without overwriting your original files.
* **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, or bulk process from the Media Library.
* **"Set as Main Product Image"** — Easily assign an upscaled image as a product's featured image with a single click.
* **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 product photography.
* **Automatic thumbnail regeneration** — Replaces or duplicates images and automatically regenerates all required WordPress thumbnails.
* **Status indicators** — See at a glance which images have already been upscaled or are low-resolution.

= How It Works =

1. Install the plugin and enter your API key from [productimageupscale.com](https://www.productimageupscale.com).
2. **From the Media Library:** Navigate to Media, click "Upscale" on any image or use Bulk Actions.
3. **From WooCommerce:** Edit any product, scroll down to the "AI Product Image Upscaler" meta box, and upscale individual gallery images or batch process them all at once.
4. 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 of the image
* 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.

* **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.

== 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? =

Yes. The original file in the Media Library is replaced with the upscaled version and all thumbnails are regenerated automatically.

= Can I upscale multiple images at once? =

Yes. Select images in the Media Library list view and choose "Batch Upscale with Product Image Upscale" from the Bulk Actions dropdown.

= 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.

== 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.

== Changelog ==

= 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.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.
