How can I extract the width of an image as defined in add_image_size
for use as a template variable?
For example if my theme defines the size small as add_image_size( 'small', 195, 146, true );
195 would be the variable.
I am trying to build a dynamic mshots url.
Generally speaking, there’s no need to do this. However, if it’s one added using
add_image_size
, it will be in the $_wp_additional_image_sizes global.This
<?php wp_get_attachment_image_src( $attachment_id); ?>
should return an array ofAlso
wp_get_attachment_metadata
returns the original image size and additional photo data.