Plugin Directory

Changeset 3420763


Ignore:
Timestamp:
12/16/2025 08:48:11 AM (4 months ago)
Author:
itpathsolutions
Message:

1.0.5

  • New - Added support for uploading multiple images from Canva directly to the website
  • Fix - Minor bug fixes and performance improvements
Location:
product-image-editor-with-canva-for-woocommerce
Files:
39 added
3 edited

Legend:

Unmodified
Added
Removed
  • product-image-editor-with-canva-for-woocommerce/trunk/README.txt

    r3361588 r3420763  
    22Contributors: itpathsolutions, raj198, pateljaymin, wpeople
    33Donate 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
     4Tags: woocommerce, bulk edit, image editor, canva integration, product images
     5Requires at least: 6.0
     6Tested up to: 6.9
     7Requires PHP: 7.4
     8Stable tag: 1.0.5
    89License: GPLv2 or later
    9 License URI: http://www.gnu.org/licenses/gpl-2.0.html
     10License URL: http://www.gnu.org/licenses/gpl-2.0.html
    1011
    11 Connect your WooCommerce store with Canva to allow product image editing and automatic gallery updates.
     12Edit WooCommerce product images directly in Canva. Bulk edit, replace, and enhance visuals with instant sync back to your product gallery.
    1213
    1314== Description ==
    1415
    15 **Connect WooCommerce to Canva** seamlessly integrates your WooCommerce store with Canva, enabling effortless product image creation and updates.
     16The Product Image Editor with Canva for WooCommerce provides a seamless, automated workflow for editing product images through Canva, all within your WooCommerce dashboard.
    1617
    17 Once 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.
     18Open 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.
    1819
    19 This plugin streamlines your product image workflow — from design to upload — all within minutes.
     20No exporting.
    2021
    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
     22No re-uploading.
     23
     24No duplicate files or outdated galleries.
     25
     26Whether 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 =
     31Open product images inside Canva directly from the WooCommerce product page or product list.
     32
     33= Bulk Edit Product Images =
     34Update images for multiple products in one action - ideal for catalog-wide refreshes or branding updates.
     35
     36= Edit, Replace, or Add New Image Variants =
     37Use 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 =
     40Save your design in Canva, and the updated image appears in your product feed instantly, without manual uploads.
     41
     42= Full Canva Creative Suite =
     43Use templates, branding kits, text, shapes, filters, backgrounds, and more, all from within WordPress.
     44
     45= Works with Variable Products =
     46Edit and sync variation images with the same workflow.
     47
     48= Lightweight & Non-Intrusive =
     49No bloat, no performance impact, and no modification to WooCommerce core files.
     50
     51= Secure Authorization =
     52Your Canva API key is stored safely within your WordPress settings.
    2653
    2754== Installation ==
    2855
    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.
     561. 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.
     572. Activate the plugin.
     583. Go to **WooCommerce → Settings → Canva Connect** from the admin sidebar.
     594. 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.
     605. Follow the instructions displayed on the right side of the screen to authorize and connect Canva with your WooCommerce store.
     616. 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
     657. When finished, click **Export Design to Product** from the app sidebar. Select the file format, dimensions, and pages to export, then click **Export**.
     66
     67The selected designs are bulk-exported back to WooCommerce automatically, with no manual downloading or re-uploading required.
    3468
    3569== Frequently Asked Questions ==
    3670
    37 = How does Canva know which store to connect to? = 
    38 Using the secure token and website URL provided by this plugin.
     71= Do I need a Canva Pro account? =
     72No. Both free and Pro Canva accounts work with this plugin.
    3973
    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? =
     75No. The plugin is lightweight and does not alter any WooCommerce core files.
    4276
    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? =
     78Yes. Select multiple products in the WooCommerce product list and use the bulk edit option.
    4579
    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? =
     81Only if you choose to replace them, and you can also add new images to the gallery.
     82
     83= Does this support variable products? =
     84Yes. Variation images can be edited and synced with the same Canva workflow.
     85
     86= Are images stored securely? =
     87Yes. Images are processed through secure API requests, and your Canva API key remains safely stored in WordPress.
    4888
    4989== Screenshots ==
    5090
    51 1. Admin settings screen showing the generated token and connection instructions
     911. Product Image Editor button inside the WooCommerce product page
     922. Canva editor opened directly from a product
     933. Bulk edit interface for multiple product images
     944. Synced gallery preview after saving in Canva
    5295
    5396== Changelog ==
    5497
    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 =
    5899
    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 
    61102
    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.
    64115
    65116= 1.0.1 =
    66 * Bug fixes
     117General Bug fixes.
    67118
    68119= 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.
    70122
    71123== Upgrade Notice ==
     124= 1.0.4 =
    72125
    73 = 1.0.0 =
    74 First release with Canva integration for WooCommerce products.
     126This 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 ==
     129Product Image Editor with Canva for WooCommerce is developed and supported by [IT Path Solutions](https://profiles.wordpress.org/itpathsolutions/). 
     130
     131If 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
     133For 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  
    148148        ]);
    149149
     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
    150156        // Register the new search route
    151157        register_rest_route('cw2c/v1', '/products/search/', [
     
    237243
    238244    /**
     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    /**
    239276     * Fetches WooCommerce products with featured and gallery images.
    240277     *
     
    392429    public function piecw_update_product_image($request) {
    393430        $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) {
    397434            return new WP_REST_Response(['error' => 'Missing parameters'], 400);
    398435        }
     
    402439        require_once ABSPATH . 'wp-admin/includes/media.php';
    403440
    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');
    405507
    406508        if (is_wp_error($image_id)) {
     
    408510        }
    409511
    410         // Add image to product gallery
     512        // Add to gallery
    411513        $gallery = get_post_meta($product_id, '_product_image_gallery', true);
    412514        $gallery_ids = $gallery ? explode(',', $gallery) : [];
    413515
    414         // Avoid duplicates
    415516        if (!in_array($image_id, $gallery_ids)) {
    416517            $gallery_ids[] = $image_id;
     
    418519        }
    419520
    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
    427524
    428525    /**
  • product-image-editor-with-canva-for-woocommerce/trunk/product-image-editor-with-canva-for-woocommerce.php

    r3361588 r3420763  
    1919 * Plugin URI:        https://wordpress.org/plugins/product-image-editor-with-canva-for-woocommerce
    2020 * Description:       Connect your WooCommerce store with Canva to allow product image editing and automatic gallery updates.
    21  * Version:           1.0.4
     21 * Version:           1.0.5
    2222 * Requires Plugins:  woocommerce
    2323 * Author:            IT Path Solutions
     
    4040 * Rename this for your plugin and update it as you release new versions.
    4141 */
    42 define( 'PRODUCT_IMAGE_EDITOR_WITH_CANVA_FOR_WOOCOMMERCE_VERSION', '1.0.4' );
     42define( 'PRODUCT_IMAGE_EDITOR_WITH_CANVA_FOR_WOOCOMMERCE_VERSION', '1.0.5' );
    4343
    4444/**
Note: See TracChangeset for help on using the changeset viewer.