diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php index 6867039ec..23c09bc93 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/cloudinary.php @@ -3,7 +3,7 @@ * Plugin Name: Cloudinary * Plugin URI: https://cloudinary.com/documentation/wordpress_integration * Description: With the Cloudinary plugin, you can upload and manage your media assets in the cloud, then deliver them to your users through a fast content delivery network, improving your website’s loading speed and overall user experience. Apply multiple transformations and take advantage of a full digital asset management solution without leaving WordPress. - * Version: 2.0.6 + * Version: 2.1.1 * Author: Cloudinary Ltd., XWP * Author URI: https://cloudinary.com/ * License: GPLv2+ diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php index 543e91caa..cdeb74eed 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-media.php @@ -574,10 +574,9 @@ public function cloudinary_url( $attachment_id, $size = array(), $transformation // Check size and correct if string or size. if ( is_string( $size ) || ( is_array( $size ) && 3 === count( $size ) ) ) { $intermediate = image_get_intermediate_size( $attachment_id, $size ); - if ( ! is_array( $intermediate ) ) { - return false; + if ( is_array( $intermediate ) ) { + $size = $this->get_crop( $intermediate['url'], $attachment_id ); } - $size = $this->get_crop( $intermediate['url'], $attachment_id ); } /** @@ -1240,14 +1239,6 @@ public function get_post_meta( $post_id, $key, $single = false ) { $data = $this->build_cached_meta( $post_id, $key, $single ); } - // If public_id, ensure there's a sync_key saved. - if ( '_public_id' === $key && empty( $meta_data[ Sync::META_KEYS['cloudinary'] ]['_sync_key'] ) ) { - - //$sync_key = '_' . md5( $data ); - //$this->update_post_meta( $post_id, '_sync_key', $sync_key ); - //update_post_meta( $post_id, $sync_key, true ); // Set sync_key. - } - return $data; } diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php index 203df4f00..279a7da93 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/connect/class-api.php @@ -189,14 +189,17 @@ function ( $item ) use ( $transformation_index ) { if ( is_string ( $item ) ) { return $item; } + foreach ( $item as $type => $value ) { // phpcs:ignore $key = array_search( $type, $transformation_index, true ); - if ( 'wpsize' === $type ) { + if ( false !== strpos( $type, 'wpsize' ) ) { if ( ! empty( $item['clean'] ) ) { continue; } + $value = '!' . $value . '!'; } + if ( false !== $key ) { $transform[] = $key . '_' . $value; } @@ -258,7 +261,6 @@ public function cloudinary_url( $public_id, $args = array(), $size = array(), $c } $url_parts[] = $args['version']; - $url_parts[] = $public_id; // Clear out empty parts. diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php index 527fd68dd..892e86a50 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-push-sync.php @@ -376,7 +376,7 @@ public function prepare_upload( $post, $down_sync = false ) { } $resource_type = $this->get_resource_type( $post ); - $max_size = ( 'image' === $resource_type ? 'image_max_size_bytes' : 'video_max_size_bytes' ); + $max_size = ( 'image' === $resource_type ? 'max_image_size' : 'max_video_size' ); if ( ! empty( $this->plugin->components['connect']->usage[ $max_size ] ) && $file_size > $this->plugin->components['connect']->usage[ $max_size ] ) { $max_size_hr = size_format( $this->plugin->components['connect']->usage[ $max_size ] ); diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php index 967549e1c..11377b172 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/sync/class-upload-sync.php @@ -202,7 +202,7 @@ public function prep_on_demand_upload( $cloudinary_id, $attachment_id ) { if ( $attachment_id && false === $cloudinary_id ) { // Check that this has not already been prepared for upload. if ( ! $this->is_pending( $attachment_id ) && apply_filters( 'cloudinary_on_demand_sync_enabled', $this->enabled ) ) { - $max_size = ( wp_attachment_is_image( $attachment_id ) ? 'image_max_size_bytes' : 'video_max_size_bytes' ); + $max_size = ( wp_attachment_is_image( $attachment_id ) ? 'max_image_size' : 'max_video_size' ); $file = get_attached_file( $attachment_id ); // Get the file size to make sure it can exist in cloudinary. if ( ! empty( $this->plugin->components['connect']->usage[ $max_size ] ) && file_exists( $file ) && filesize( $file ) < $this->plugin->components['connect']->usage[ $max_size ] ) { diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/readme.txt b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/readme.txt index 19fdc2fbe..29bc2d635 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/readme.txt +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/readme.txt @@ -2,7 +2,7 @@ Contributors: Cloudinary, XWP, Automattic Tags: images, videos, DAM, optimizations, CDN, media, gallery, photo, photos, picture, pictures, thumbnail, upload, admin, administration, api, cms, dashboard, editor, integration, manage, mobile, social-media Requires at least: 4.7 -Tested up to: 5.4 +Tested up to: 5.4.1 Requires PHP: 5.6 Stable tag: trunk License: GPLv2 @@ -108,14 +108,25 @@ You can read the plugin [documentation](https://cloudinary.com/documentation/wor 9. Easily Configure Your Account == Changelog == -= 2.0.3 (03 Apr 2020) = - * Fix migration issue += 2.1.1 (01 Jun 2020) = + +New features: + + * We now provide several options for the WP<->Cloudinary sync, allowing you to better control your media: + - Bulk-sync - Will sync all assets with Cloudinary in a click-of-a-button. + - Auto-sync - Will sync new uploaded assets in an on-demand manner. + - Manual - Added a `push to Cloudinary` button to the Media Library bulk actions that allows syncing selected assets to Cloudinary. + * Global Transformations are now being applied to Featured Images. + * Added an `Account Status` to the dashboard tab, displaying the account usage, quota and metrics. -= 2.0.2 (03 Apr 2020) = - * Rollback last fix +Fixes and Improvements: -= 2.0.1 (02 Apr 2020) = - * Fix an issue with v1 migrating + * Improved the sync mechanism. + * General bug fixes and performance improvements. + * Improved error handling. + += 2.0.3 (03 Apr 2020) = + * Fix migration issue = 2.0.0 (31 Mar 2020) = * Release of a new major version of the plugin