Dynamically insert width and height
-
Thank you for developing this great plug-in.
I was wondering if you could help – I have been sitting with this issue for a couple of hours now.
Is there a way of accessing image attributes and dynamically adding width and height?
if( class_exists(‘Dynamic_Featured_Image’) ) {
global $dynamic_featured_image;
$featured_images = $dynamic_featured_image->get_featured_images( );
//print_r($featured_images);//You can now loop through the image to display them as required
foreach($featured_images as $featured_image) {$image_attributes = wp_get_attachment_image_src( $featured_image [‘full’] );
$width = $image_attributes[1];
$height = $image_attributes[2];
echo “<img src='”.$featured_image[‘full’].”‘”;
echo “width='”.$width.”‘”;
echo “height='”.$height.”‘”;
echo ‘/>’;
}
}https://www.ads-software.com/plugins/dynamic-featured-image/
- The topic ‘Dynamically insert width and height’ is closed to new replies.