Prechádzať zdrojové kódy

Fix admin download serving WP-scaled image instead of raw upload — v1.2.2 -> v1.2.3

WP auto-creates a -scaled.jpg for images above the big-image threshold
(2560 px), and get_attached_file() returns that scaled copy. Switch both
single-file and ZIP downloads to wp_get_original_image_path() so admins
receive the true original upload.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dalibor Votruba 3 mesiacov pred
rodič
commit
7fb2ad794f

+ 1 - 1
studiou-wc-free-photo-product/CLAUDE.md

@@ -2,7 +2,7 @@
 
 ## Project Overview
 
-WordPress/WooCommerce plugin called **studiou-wc-free-photo-product** (QDR - Studiou WC Free Photo Product) v1.2.1.
+WordPress/WooCommerce plugin called **studiou-wc-free-photo-product** (QDR - Studiou WC Free Photo Product) v1.2.3.
 Allows publishing special variable products where customers upload custom raw images to be printed for a price.
 
 ## Initial Requirements

+ 9 - 3
studiou-wc-free-photo-product/includes/class-studiou-wc-fpp-admin.php

@@ -188,7 +188,10 @@ class Studiou_WC_FPP_Admin {
 
         $added = 0;
         foreach ($records as $record) {
-            $file_path = get_attached_file($record->attachment_id);
+            $file_path = wp_get_original_image_path($record->attachment_id);
+            if (!$file_path) {
+                $file_path = get_attached_file($record->attachment_id);
+            }
             if ($file_path && file_exists($file_path)) {
                 // Use order number prefix if available
                 $prefix = $record->order_id ? 'order-' . $record->order_id . '_' : '';
@@ -283,8 +286,11 @@ class Studiou_WC_FPP_Admin {
             }
         }
 
-        // Serve the file
-        $file_path = get_attached_file($attachment_id);
+        // Serve the original (unscaled) file — WP auto-scales images above the big-image threshold.
+        $file_path = wp_get_original_image_path($attachment_id);
+        if (!$file_path) {
+            $file_path = get_attached_file($attachment_id);
+        }
         if (!$file_path || !file_exists($file_path)) {
             wp_die(__('File not found.', 'studiou-wc-free-photo-product'));
         }

+ 1 - 1
studiou-wc-free-photo-product/languages/studiou-wc-free-photo-product-cs_CZ.po

@@ -3,7 +3,7 @@
 # This file is distributed under the GPL v2 or later.
 msgid ""
 msgstr ""
-"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.2.2\n"
+"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.2.3\n"
 "Report-Msgid-Bugs-To: https://www.quadarax.com\n"
 "POT-Creation-Date: 2026-04-02 00:00+0000\n"
 "PO-Revision-Date: 2026-04-02 00:00+0000\n"

+ 1 - 1
studiou-wc-free-photo-product/languages/studiou-wc-free-photo-product.pot

@@ -2,7 +2,7 @@
 # This file is distributed under the GPL v2 or later.
 msgid ""
 msgstr ""
-"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.2.2\n"
+"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.2.3\n"
 "Report-Msgid-Bugs-To: https://www.quadarax.com\n"
 "POT-Creation-Date: 2026-04-02 00:00+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"

+ 1 - 0
studiou-wc-free-photo-product/readme.md

@@ -79,6 +79,7 @@ Navigate to **Products > Free Photo Files** to manage uploaded files.
 - Single file download (automatically marks status as "downloaded" if currently "ready")
 - Single file delete with media attachment cleanup
 - Bulk actions with confirmation dialogs: Download as ZIP, Set Status (Ready / Downloaded / Solved), Delete
+- Downloads always serve the **original, unscaled** file. WordPress auto-creates a `-scaled.jpg` for images above the big-image threshold (2560 px by default), but both single and ZIP downloads use `wp_get_original_image_path()` to return the raw upload.
 - Order number links (HPOS-compatible)
 - Customer name display
 - Pagination (30 files per page, preserves active filters across pages)

+ 2 - 2
studiou-wc-free-photo-product/studiou-wc-free-photo-product.php

@@ -3,7 +3,7 @@
  * Plugin Name: QDR - Studiou WC Free Photo Product
  * Plugin URI: https://www.quadarax.com/plugins/studiou-wc-free-photo-product
  * Description: Allows publishing special WooCommerce products with variants and custom raw image upload for photo printing
- * Version: 1.2.2
+ * Version: 1.2.3
  * Requires at least: 6.9.4
  * Requires PHP: 8.2
  * Author: Dalibor Votruba
@@ -21,7 +21,7 @@ if (!defined('WPINC')) {
     die;
 }
 
-if (!defined('STUDIOU_WCFPP_VERSION')) define('STUDIOU_WCFPP_VERSION', '1.2.2');
+if (!defined('STUDIOU_WCFPP_VERSION')) define('STUDIOU_WCFPP_VERSION', '1.2.3');
 if (!defined('STUDIOU_WCFPP_PLUGIN_DIR')) define('STUDIOU_WCFPP_PLUGIN_DIR', plugin_dir_path(__FILE__));
 if (!defined('STUDIOU_WCFPP_PLUGIN_URL')) define('STUDIOU_WCFPP_PLUGIN_URL', plugin_dir_url(__FILE__));
 if (!defined('STUDIOU_WCFPP_PLUGIN_BASENAME')) define('STUDIOU_WCFPP_PLUGIN_BASENAME', plugin_basename(__FILE__));