Created
October 19, 2023 23:15
Revisions
-
robertdevore created this gist
Oct 19, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ <?php /** * Get explicit image sizes * * @param string $image_url The image URL - https:// ... * * @return string */ function get_explicit_image_sizes( $image_url ) { $img_explicit = ''; if ( $image_url ) { $logo_media_id = get_media_id_from_url( $image_url ); $img_dimensions = get_image_sizes_by_id( $logo_media_id ); if ( $img_dimensions ) { $img_explicit = ' width="' . $img_dimensions['width'] . '" height="' . $img_dimensions['height'] . '" '; } } return $img_explicit; }