Skip to content

Commit 9b2dd0b

Browse files
authored
Merge pull request #871 from cloudinary/hotfix/3.1.2-build-1
Hotfix 3.1.2 build 1
2 parents 952f08d + bec0c0d commit 9b2dd0b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

php/class-delivery.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,9 @@ public function find_attachment_size_urls() {
870870
if ( true === $auto_sync ) {
871871
$this->sync->add_to_sync( $result->post_id );
872872
}
873-
$size = $this->get_sized( $result->post_id );
874-
$cached[ $size['sized_url'] ] = (int) $result->post_id;
873+
$size = $this->get_sized( $result->post_id );
874+
$key = ! empty( $size['sized_url'] ) ? $size['sized_url'] : wp_get_attachment_url( $result->post_id );
875+
$cached[ $key ] = (int) $result->post_id;
875876
}
876877
}
877878
wp_cache_add( $key, $cached );
@@ -1304,7 +1305,7 @@ public function parse_element( $element ) {
13041305

13051306
// Check if this is a crop or a scale.
13061307
$has_size = $this->media->get_size_from_url( $this->sanitize_url( $raw_url ) );
1307-
if ( ! empty( $has_size ) ) {
1308+
if ( ! empty( $has_size ) && ! empty( $item['height'] ) ) {
13081309
$file_ratio = round( $has_size[0] / $has_size[1], 2 );
13091310
$original_ratio = round( $item['width'] / $item['height'], 2 );
13101311
if ( $file_ratio !== $original_ratio ) {

0 commit comments

Comments
 (0)