From c1b1ec03a224192100e562f89225d4a919ac8187 Mon Sep 17 00:00:00 2001 From: Juerg Hunziker Date: Thu, 31 May 2018 13:12:26 +0200 Subject: [PATCH] fetch image meta if not passed --- src/class-rokka-helper.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/class-rokka-helper.php b/src/class-rokka-helper.php index 46d27ab..8052bc0 100644 --- a/src/class-rokka-helper.php +++ b/src/class-rokka-helper.php @@ -853,6 +853,10 @@ public function get_size_by_image_name( $image_id, $image_name, $image_meta = ar * @return string */ public function get_size_by_image_url( $image_id, $image_url, $image_meta = array() ) { + if ( empty( $image_meta ) ) { + $image_meta = wp_get_attachment_metadata( $image_id ); + } + $last_slash_pos = strrpos( $image_url, '/' ); if ( false === $last_slash_pos ) {