=== GadgettPhotoBuilder ===
Contributors: gadgetmall
Tags: woocommerce, photo, print, upload, crop
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Photo print ordering for WooCommerce with private photo storage, a local crop editor and print PDF generation.

== Description ==

GadgettPhotoBuilder adds a printed-product type, photo uploads and crop editing,
post-purchase upload links, private order photos, admin ZIP download and local A4
PDF generation. WooCommerce 8.2 or later is required. Photo files need PHP GD or
an available WordPress image editor; ZIP download requires PHP ZipArchive.

CropperJS and TCPDF are bundled locally. No AI provider is used. No photos or
customer information are emailed to a fixed production mailbox. The former
site-specific SMTP override and photo-email feature have been removed.

Classic checkout is supported. Checkout Blocks integration has not been verified;
use classic checkout until that integration is tested. HPOS uses WooCommerce CRUD
order access and the WooCommerce order screen. Test your own workflow on staging.

== Installation ==

1. Back up the database and old photo directories. Deactivate the former Woo Photo
   Print Builder before activating this renamed plugin. Do not run both together.
2. Install and activate WooCommerce, then activate GadgettPhotoBuilder.
3. Configure a persistent, private, writable directory outside every web document
   root with WPB_PRIVATE_STORAGE_DIR in wp-config.php. Only the PHP user should have
   access. The fallback is a site-specific directory in the system temporary path;
   host cleanup can remove it, so persistent storage is recommended for production.
4. Create a printed product, set print count (at most 100) and price, and publish it.
5. Create a page with [photo_print_upload] for post-purchase uploads.
6. Keep WordPress cron running, or arrange an external cron to run WordPress cron
   events. Cleanup is hourly. Review MIGRATION.txt before upgrading an old store.

== Privacy and retention ==

Photos are re-encoded and stored outside the web root. Temporary session photos
are removed after 24 hours; order photo directories after 90 days. Authorized
store managers and the signed-in order customer can read order photos. A customer
presenting a valid post-purchase upload token gets a signed HttpOnly, SameSite=Lax
order-access cookie for one hour. Upload links are bearer credentials: keep them
private. Never cache upload pages or the private-file AJAX endpoint.

Each upload is limited to 10 MB and 12 megapixels, and each image side to 10000
pixels. Per session/order upload directories have a 200 MB storage budget and at
most 100 photos (subject to the product/order count). Site photo storage has a
2 GB cap. Upload attempts are limited to 100 per hour per salted IP hash; the raw
IP is not stored in that transient. Limits may be reached before a store finishes
production: monitor disk use and export completed orders when needed.

Order/product records and plugin options are retained when deactivated or removed.
Deactivation stops cleanup. Private photo files remain and must be handled under
the store's retention policy. Existing public photos are not silently migrated.
Use the WordPress privacy-policy suggestion as a starting point and disclose any
optional Google Drive use in the store's customer privacy policy.

== External services ==

Google Drive sync is optional and off unless explicitly enabled in the plugin's
Google Drive settings and connected using the store's Google OAuth application.
When an eligible order PDF is generated or a manager requests a sync, the plugin
sends cropped photos and the PDF to the configured Drive folder. Folder names
include order number and customer first/last name. Google receives OAuth client
information and authorization/refresh tokens for authentication. The connection
uses the drive.file scope. The store controls its Google account and storage costs.
Disconnect in settings to remove locally stored access/refresh tokens; revoke the
app's access in Google to revoke the grant. Previously synced files stay in Google
Drive until the store deletes them. Automatic local cleanup does not delete them.

Google Terms: https://policies.google.com/terms
Google Privacy: https://policies.google.com/privacy
Google API Services User Data Policy: https://developers.google.com/terms/api-services-user-data-policy

There is no remote CDN dependency or vendor telemetry. Customer notification
email, if used by WooCommerce, follows the store's existing mail configuration.

== Frequently Asked Questions ==

= Will existing wpb settings and order/product data be lost? =

No. The wpb option keys, order/product meta keys, printed_product type and upload
shortcode are retained. See MIGRATION.txt for private-photo migration planning.

= Where are PDFs generated? =

On the WordPress server using bundled TCPDF 6.11.4. A PDF failure is reported as an
error; no empty PDF or HTML file is substituted for a successful PDF.

= Is this a paid service connector? =

Local uploads, cropping and PDFs work without a paid service. Optional Google
Drive requires a Google account and an OAuth application configured by the store.

== Third party code ==

CropperJS 1.5.13, MIT: https://github.com/fengyuanchen/cropperjs/tree/v1.5.13
Source includes distributed JS/CSS. License: vendor/cropperjs/LICENSE.
TCPDF 6.11.4, LGPL-3.0-or-later: https://github.com/tecnickcom/TCPDF/tree/6.11.4
Runtime PHP and standard fonts are bundled. License: vendor/tcpdf/LICENSE.TXT.
Upstream includes additional fonts/examples not required for this integration.
GadgettPhotoBuilder code is GPL-2.0-or-later; linked combined distributions must
respect the LGPL-3.0-or-later terms of the bundled TCPDF component.

== Changelog ==

= 1.1.0 =
* Renamed to GadgettPhotoBuilder; existing wpb data keys retained.
* Added private storage and authorized media access, strict registered image IDs,
  nonempty order-token authorization, bounded crops, quotas and scheduled cleanup.
* Bundled local CropperJS and real TCPDF generation.
* Added one-time user-bound OAuth state and removed fixed photo-email recipient.
* Updated WooCommerce dependencies, order CRUD screen support and service disclosure.

== Upgrade Notice ==

= 1.1.0 =
Staging upgrade required. Read MIGRATION.txt. Old public photos need a separately
reviewed migration and web-server access restrictions. No live migration is run.
