From 63224dd52885d4b15f0d8efb1ecdf9cff7423b60 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Fri, 24 Apr 2020 16:43:59 +0100 Subject: [PATCH 1/3] Set default for enabled_breakpoints setting --- .../tabs/settings-global-transformations.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-transformations.php b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-transformations.php index 4bba414ce..77f96bed7 100644 --- a/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-transformations.php +++ b/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/ui-definitions/tabs/settings-global-transformations.php @@ -19,9 +19,10 @@ 'label' => __( 'Responsive Image Settings', 'cloudinary' ), ), 'enable_breakpoints' => array( - 'label' => __( 'Enable Breakpoints', 'cloudinary' ), - 'suffix' => __( 'Enable breakpoint generation on upload.', 'cloudinary' ), - 'type' => 'checkbox', + 'label' => __( 'Enable Breakpoints', 'cloudinary' ), + 'suffix' => __( 'Enable breakpoint generation on upload.', 'cloudinary' ), + 'type' => 'checkbox', + 'default' => 'off', ), 'breakpoints' => array( 'label' => __( 'Max breakpoints', 'cloudinary' ), From 9131d93df96adb212b3d4ff3b2351bf4d8081aeb Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Fri, 24 Apr 2020 16:44:20 +0100 Subject: [PATCH 2/3] Confirm that $intermediate is an array --- .../php/class-media.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 f91414f2a..6bae12a0e 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,7 +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 ); - $size = $this->get_crop( $intermediate['url'], $attachment_id ); + if ( is_array( $intermediate ) ) { + $size = $this->get_crop( $intermediate['url'], $attachment_id ); + } } /** From e4a6f6a51a730e3e2f80cad8bc2247528757b086 Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Fri, 24 Apr 2020 16:44:32 +0100 Subject: [PATCH 3/3] Initialize variable --- .../php/sync/class-push-sync.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 a1a9ae025..254e2e577 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 @@ -330,7 +330,8 @@ public function prepare_upload( $post, $down_sync = false ) { } // First check if this has a file and it can be uploaded. - $file = get_attached_file( $post->ID ); + $file = get_attached_file( $post->ID ); + $file_size = 0; if ( empty( $file ) ) { return new \WP_Error( 'attachment_no_file', __( 'Attachment did not have a file.', 'cloudinary' ) ); } elseif ( ! file_exists( $file ) ) { @@ -347,8 +348,6 @@ public function prepare_upload( $post, $down_sync = false ) { } $file = get_attached_file( $post->ID ); $file_size = filesize( $file ); - } else { - $file_size = 0; } } } else {