Changeset 3420763
- Timestamp:
- 12/16/2025 08:48:11 AM (4 months ago)
- Location:
- product-image-editor-with-canva-for-woocommerce
- Files:
-
- 39 added
- 3 edited
-
tags/1.0.5 (added)
-
tags/1.0.5/LICENSE.txt (added)
-
tags/1.0.5/README.txt (added)
-
tags/1.0.5/admin (added)
-
tags/1.0.5/admin/class-product-image-editor-with-canva-for-woocommerce-admin.php (added)
-
tags/1.0.5/admin/css (added)
-
tags/1.0.5/admin/css/product-image-editor-with-canva-for-woocommerce-admin.css (added)
-
tags/1.0.5/admin/index.php (added)
-
tags/1.0.5/admin/js (added)
-
tags/1.0.5/admin/js/product-image-editor-with-canva-for-woocommerce-admin.js (added)
-
tags/1.0.5/admin/jwt (added)
-
tags/1.0.5/admin/jwt/CHANGELOG.md (added)
-
tags/1.0.5/admin/jwt/LICENSE (added)
-
tags/1.0.5/admin/jwt/README.md (added)
-
tags/1.0.5/admin/jwt/composer.json (added)
-
tags/1.0.5/admin/jwt/src (added)
-
tags/1.0.5/admin/jwt/src/BeforeValidException.php (added)
-
tags/1.0.5/admin/jwt/src/CachedKeySet.php (added)
-
tags/1.0.5/admin/jwt/src/ExpiredException.php (added)
-
tags/1.0.5/admin/jwt/src/JWK.php (added)
-
tags/1.0.5/admin/jwt/src/JWT.php (added)
-
tags/1.0.5/admin/jwt/src/JWTExceptionWithPayloadInterface.php (added)
-
tags/1.0.5/admin/jwt/src/Key.php (added)
-
tags/1.0.5/admin/jwt/src/SignatureInvalidException.php (added)
-
tags/1.0.5/admin/partials (added)
-
tags/1.0.5/admin/partials/class-wc-settings-canva-connect.php (added)
-
tags/1.0.5/admin/partials/product-image-editor-with-canva-for-woocommerce-admin-display.php (added)
-
tags/1.0.5/includes (added)
-
tags/1.0.5/includes/class-product-image-editor-with-canva-for-woocommerce-activator.php (added)
-
tags/1.0.5/includes/class-product-image-editor-with-canva-for-woocommerce-deactivator.php (added)
-
tags/1.0.5/includes/class-product-image-editor-with-canva-for-woocommerce-i18n.php (added)
-
tags/1.0.5/includes/class-product-image-editor-with-canva-for-woocommerce-loader.php (added)
-
tags/1.0.5/includes/class-product-image-editor-with-canva-for-woocommerce.php (added)
-
tags/1.0.5/includes/index.php (added)
-
tags/1.0.5/index.php (added)
-
tags/1.0.5/languages (added)
-
tags/1.0.5/languages/product-image-editor-with-canva-for-woocommerce.pot (added)
-
tags/1.0.5/product-image-editor-with-canva-for-woocommerce.php (added)
-
tags/1.0.5/uninstall.php (added)
-
trunk/README.txt (modified) (1 diff)
-
trunk/admin/class-product-image-editor-with-canva-for-woocommerce-admin.php (modified) (6 diffs)
-
trunk/product-image-editor-with-canva-for-woocommerce.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
product-image-editor-with-canva-for-woocommerce/trunk/README.txt
r3361588 r3420763 2 2 Contributors: itpathsolutions, raj198, pateljaymin, wpeople 3 3 Donate link: https://www.itpathsolutions.com/ 4 Tags: woocommerce, canva, image editing, product images, product gallery 5 Requires at least: 5.8 6 Tested up to: 6.8 7 Stable tag: 1.0.4 4 Tags: woocommerce, bulk edit, image editor, canva integration, product images 5 Requires at least: 6.0 6 Tested up to: 6.9 7 Requires PHP: 7.4 8 Stable tag: 1.0.5 8 9 License: GPLv2 or later 9 License UR I: http://www.gnu.org/licenses/gpl-2.0.html10 License URL: http://www.gnu.org/licenses/gpl-2.0.html 10 11 11 Connect your WooCommerce store with Canva to allow product image editing and automatic gallery updates.12 Edit WooCommerce product images directly in Canva. Bulk edit, replace, and enhance visuals with instant sync back to your product gallery. 12 13 13 14 == Description == 14 15 15 **Connect WooCommerce to Canva** seamlessly integrates your WooCommerce store with Canva, enabling effortless product image creation and updates.16 The Product Image Editor with Canva for WooCommerce provides a seamless, automated workflow for editing product images through Canva, all within your WooCommerce dashboard. 16 17 17 O nce connected via a secure Authorization Code, Canva can fetch your WooCommerce product data. You can then design or update product images using Canva’s powerful tools. When you're done, export the image (PNG or JPG), and it will be automatically added to the product gallery in your WooCommerce store.18 Open any product image or entire gallery inside Canva, design, update, or add variants using Canva’s full creative suite. Once you click Save, the updated images sync instantly back to WooCommerce. 18 19 19 This plugin streamlines your product image workflow — from design to upload — all within minutes.20 No exporting. 20 21 21 ### Key Features: 22 * Generates a secure authorization code and website URL for connection 23 * Allows Canva to fetch WooCommerce product data 24 * Enables image editing directly in Canva 25 * Automatically updates WooCommerce product gallery with new images 22 No re-uploading. 23 24 No duplicate files or outdated galleries. 25 26 Whether you're refreshing a large catalog, updating seasonal products, or maintaining consistent brand visuals, this plugin makes WooCommerce product image editing fast, simple, and clutter-free. 27 28 == Features == 29 30 = Direct Canva Integration = 31 Open product images inside Canva directly from the WooCommerce product page or product list. 32 33 = Bulk Edit Product Images = 34 Update images for multiple products in one action - ideal for catalog-wide refreshes or branding updates. 35 36 = Edit, Replace, or Add New Image Variants = 37 Use Canva to create new product images or update existing ones. Synced files automatically replace or append to your product gallery. 38 39 = Automatic Sync Back to WooCommerce = 40 Save your design in Canva, and the updated image appears in your product feed instantly, without manual uploads. 41 42 = Full Canva Creative Suite = 43 Use templates, branding kits, text, shapes, filters, backgrounds, and more, all from within WordPress. 44 45 = Works with Variable Products = 46 Edit and sync variation images with the same workflow. 47 48 = Lightweight & Non-Intrusive = 49 No bloat, no performance impact, and no modification to WooCommerce core files. 50 51 = Secure Authorization = 52 Your Canva API key is stored safely within your WordPress settings. 26 53 27 54 == Installation == 28 55 29 1. Upload the plugin to `/wp-content/plugins/product-image-editor-with-canva-for-woocommerce` or install it via WordPress. 30 2. Activate the plugin through the Plugins menu. 31 3. Go to **WooCommerce → Setting → Canva Connect** from the admin sidebar. 32 4. Copy the **Authorization Code** and **Website URL** into your Canva application. 33 5. Your Canva app will now be able to list products and push new images to your WooCommerce gallery. 56 1. Upload the plugin files to `/wp-content/plugins/product-image-editor-with-canva-for-woocommerce/` or install it via **Plugins → Add New** in the WordPress admin. 57 2. Activate the plugin. 58 3. Go to **WooCommerce → Settings → Canva Connect** from the admin sidebar. 59 4. On the left side of the screen, note the **Canva Authorization Code** and **Website URL**. These values are required to complete the connection with Canva. 60 5. Follow the instructions displayed on the right side of the screen to authorize and connect Canva with your WooCommerce store. 61 6. Once connected, your WooCommerce products will be available directly inside Canva. From there, you can: 62 - Edit or replace existing product images 63 - Apply new designs 64 - Create new image variants 65 7. When finished, click **Export Design to Product** from the app sidebar. Select the file format, dimensions, and pages to export, then click **Export**. 66 67 The selected designs are bulk-exported back to WooCommerce automatically, with no manual downloading or re-uploading required. 34 68 35 69 == Frequently Asked Questions == 36 70 37 = How does Canva know which store to connect to? =38 Using the secure token and website URL provided bythis plugin.71 = Do I need a Canva Pro account? = 72 No. Both free and Pro Canva accounts work with this plugin. 39 73 40 = Where are the new images saved? =41 All new images edited in Canva are saved to the WooCommerce product **gallery**.74 = Does this modify my existing WooCommerce setup? = 75 No. The plugin is lightweight and does not alter any WooCommerce core files. 42 76 43 = Does it overwrite existing images? =44 No. The new image is added to the product’s gallery as a new image.77 = Can I bulk edit multiple products at once? = 78 Yes. Select multiple products in the WooCommerce product list and use the bulk edit option. 45 79 46 = Is the integration secure? = 47 Yes. Only with the correct authorization token and domain can the Canva app access your store data. 80 = Will my original images be deleted? = 81 Only if you choose to replace them, and you can also add new images to the gallery. 82 83 = Does this support variable products? = 84 Yes. Variation images can be edited and synced with the same Canva workflow. 85 86 = Are images stored securely? = 87 Yes. Images are processed through secure API requests, and your Canva API key remains safely stored in WordPress. 48 88 49 89 == Screenshots == 50 90 51 1. Admin settings screen showing the generated token and connection instructions 91 1. Product Image Editor button inside the WooCommerce product page 92 2. Canva editor opened directly from a product 93 3. Bulk edit interface for multiple product images 94 4. Synced gallery preview after saving in Canva 52 95 53 96 == Changelog == 54 97 55 = 1.0.4 56 * Added "Requires Plugins: woocommerce" header for proper dependency handling. 57 * Fixed PHP syntax errors for better compatibility. 98 = 1.0.5 = 58 99 59 = 1.0.3 60 * Added missing direct file access protection (ABSPATH checks) to prevent unauthorized access.100 * New - Added support for uploading multiple images from Canva directly to the website 101 * Fix - Minor bug fixes and performance improvements 61 102 62 = 1.0.2 63 * Plugin name changes 103 = 1.0.4 = 104 105 - Added "Requires Plugins: woocommerce" header for proper dependency handling. 106 - Fixed PHP syntax errors for better compatibility. 107 108 = 1.0.3 = 109 110 - Added missing direct file access protection (ABSPATH checks) to prevent unauthorized access. 111 112 = 1.0.2 = 113 114 - Updated plugin name. 64 115 65 116 = 1.0.1 = 66 * Bug fixes 117 General Bug fixes. 67 118 68 119 = 1.0.0 = 69 * Initial release: Token generation, product fetch, image sync to gallery via Canva 120 121 - Initial release with token generation, product fetch, and image sync to WooCommerce galleries via Canva. 70 122 71 123 == Upgrade Notice == 124 = 1.0.4 = 72 125 73 = 1.0.0 = 74 First release with Canva integration for WooCommerce products. 126 This update adds the "Requires Plugins: woocommerce" header for proper dependency handling and resolves PHP syntax errors for improved compatibility. An update is recommended for smoother performance and more reliable plugin behavior. 127 128 == Support == 129 Product Image Editor with Canva for WooCommerce is developed and supported by [IT Path Solutions](https://profiles.wordpress.org/itpathsolutions/). 130 131 If you have questions or encounter issues, visit our [Support Forum](https://wordpress.org/support/plugin/contact-form-to-any-api/) or contact **[support@contactformtoapi.com](mailto:support@contactformtoapi.com)**. 132 133 For help, feature requests, or feedback, please use the [WordPress.org](http://wordpress.org/) support -
product-image-editor-with-canva-for-woocommerce/trunk/admin/class-product-image-editor-with-canva-for-woocommerce-admin.php
r3361588 r3420763 148 148 ]); 149 149 150 register_rest_route('cw2c/v1', '/product/(?P<id>\d+)', [ 151 'methods' => 'GET', 152 'callback' => array(&$this,'piecw_get_product'), 153 'permission_callback' => [&$this, 'piecw_check_token_permission'], 154 ]); 155 150 156 // Register the new search route 151 157 register_rest_route('cw2c/v1', '/products/search/', [ … … 237 243 238 244 /** 245 * Get single product 246 * 247 * @since 1.0.0 248 */ 249 public function piecw_get_product($request) { 250 $id = $request->get_param('id'); 251 $product = wc_get_product($id); 252 253 if (!$product) { 254 return new WP_Error('no_product', 'Product not found', ['status' => 404]); 255 } 256 257 // Get Featured Image 258 $featured_image = wp_get_attachment_url($product->get_image_id()); 259 260 // Get Gallery Images 261 $gallery_ids = $product->get_gallery_image_ids(); 262 $gallery_images = []; 263 foreach ($gallery_ids as $img_id) { 264 $gallery_images[] = wp_get_attachment_url($img_id); 265 } 266 // Response 267 return [ 268 'id' => $product->get_id(), 269 'name' => $product->get_name(), 270 'featured_image' => $featured_image, 271 'gallery_images' => $gallery_images, 272 ]; 273 } 274 275 /** 239 276 * Fetches WooCommerce products with featured and gallery images. 240 277 * … … 392 429 public function piecw_update_product_image($request) { 393 430 $product_id = (int) $request->get_param('product_id'); 394 $ image_url = esc_url_raw($request->get_param('image_url'));395 396 if (!$ image_url || !$product_id) {431 $url = $request->get_param('image_url'); 432 433 if (!$url || !$product_id) { 397 434 return new WP_REST_Response(['error' => 'Missing parameters'], 400); 398 435 } … … 402 439 require_once ABSPATH . 'wp-admin/includes/media.php'; 403 440 404 $image_id = media_sideload_image($image_url, $product_id, null, 'id'); 441 // If Canva gives ZIP file 442 $is_zip = str_contains($url, '.zip'); 443 444 if ($is_zip) { 445 $tmp = download_url($url); 446 447 if (is_wp_error($tmp)) { 448 return new WP_REST_Response(['error' => 'ZIP download failed'], 500); 449 } 450 451 // Create temp folder 452 $extract_to = WP_CONTENT_DIR . '/uploads/canva-temp-' . time(); 453 wp_mkdir_p($extract_to); 454 455 // Extract ZIP 456 $zip = new ZipArchive; 457 if ($zip->open($tmp) === TRUE) { 458 $zip->extractTo($extract_to); 459 $zip->close(); 460 } else { 461 return new WP_REST_Response(['error' => 'ZIP extraction failed'], 500); 462 } 463 464 unlink($tmp); // remove temp zip file 465 466 // Loop through extracted images 467 $dir_files = scandir($extract_to); 468 $uploaded_ids = []; 469 470 foreach ($dir_files as $file) { 471 if (preg_match('/\.(jpg|jpeg|png|webp)$/i', $file)) { 472 473 $file_path = $extract_to . '/' . $file; 474 475 $upload_id = media_handle_sideload([ 476 'name' => $file, 477 'tmp_name' => $file_path, 478 ], $product_id); 479 480 if (!is_wp_error($upload_id)) { 481 $uploaded_ids[] = $upload_id; 482 } 483 } 484 } 485 486 // Add to gallery 487 $gallery = get_post_meta($product_id, '_product_image_gallery', true); 488 $gallery_ids = $gallery ? explode(',', $gallery) : []; 489 490 foreach ($uploaded_ids as $id) { 491 if (!in_array($id, $gallery_ids)) { 492 $gallery_ids[] = $id; 493 } 494 } 495 496 update_post_meta($product_id, '_product_image_gallery', implode(',', $gallery_ids)); 497 498 // Cleanup folder 499 foreach (glob($extract_to . '/*') as $f) unlink($f); 500 rmdir($extract_to); 501 502 return new WP_REST_Response(['success' => true, 'images_uploaded' => $uploaded_ids], 200); 503 } 504 505 // Normal image URL (works as before) 506 $image_id = media_sideload_image($url, $product_id, null, 'id'); 405 507 406 508 if (is_wp_error($image_id)) { … … 408 510 } 409 511 410 // Add image to productgallery512 // Add to gallery 411 513 $gallery = get_post_meta($product_id, '_product_image_gallery', true); 412 514 $gallery_ids = $gallery ? explode(',', $gallery) : []; 413 515 414 // Avoid duplicates415 516 if (!in_array($image_id, $gallery_ids)) { 416 517 $gallery_ids[] = $image_id; … … 418 519 } 419 520 420 // Optionally set as featured image 421 // set_post_thumbnail($product_id, $image_id); 422 423 return new WP_REST_Response([ 424 'success' => true, 425 ], 200); 426 } 521 return new WP_REST_Response(['success' => true, 'image_id' => $image_id], 200); 522 } 523 427 524 428 525 /** -
product-image-editor-with-canva-for-woocommerce/trunk/product-image-editor-with-canva-for-woocommerce.php
r3361588 r3420763 19 19 * Plugin URI: https://wordpress.org/plugins/product-image-editor-with-canva-for-woocommerce 20 20 * Description: Connect your WooCommerce store with Canva to allow product image editing and automatic gallery updates. 21 * Version: 1.0. 421 * Version: 1.0.5 22 22 * Requires Plugins: woocommerce 23 23 * Author: IT Path Solutions … … 40 40 * Rename this for your plugin and update it as you release new versions. 41 41 */ 42 define( 'PRODUCT_IMAGE_EDITOR_WITH_CANVA_FOR_WOOCOMMERCE_VERSION', '1.0. 4' );42 define( 'PRODUCT_IMAGE_EDITOR_WITH_CANVA_FOR_WOOCOMMERCE_VERSION', '1.0.5' ); 43 43 44 44 /**
Note: See TracChangeset
for help on using the changeset viewer.