Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

/**
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] ) {
Expand Down