diff --git a/safe-svg.php b/safe-svg.php index 9bcadc1..073ba4a 100644 --- a/safe-svg.php +++ b/safe-svg.php @@ -446,7 +446,7 @@ public function one_pixel_fix( $image, $attachment_id, $size, $icon ) { if ( get_post_mime_type( $attachment_id ) === 'image/svg+xml' ) { $dimensions = $this->get_svg_dimensions( $attachment_id, $size ); - if ( $dimensions && $dimensions['height'] && $dimensions['width'] ) { + if ( is_array( $dimensions ) && isset( $dimensions['height'], $dimensions['width'] ) ) { $image[1] = $dimensions['width']; $image[2] = $dimensions['height']; } else { @@ -502,7 +502,7 @@ public function get_image_tag_override( $html, $id, $alt, $title, $align, $size if ( 'image/svg+xml' === $mime ) { $dimensions = $this->get_svg_dimensions( $id, $size ); - if ( $dimensions['height'] && $dimensions['width'] ) { + if ( is_array( $dimensions ) && isset( $dimensions['height'], $dimensions['width'] ) ) { $html = str_replace( 'width="1" ', sprintf( 'width="%s" ', $dimensions['width'] ), $html ); $html = str_replace( 'height="1" ', sprintf( 'height="%s" ', $dimensions['height'] ), $html ); } else { @@ -796,7 +796,6 @@ protected function get_svg_dimensions( $id, $size ) { return $dimensions; } - } }