Use the second parameter of wp_get_attachment_image_src()
: $size
.
$att = wp_get_attachment_image_src( $att_ID, 'large-thumb' );
or
$att = wp_get_attachment_image_src( $att_ID, array ( 900, 300 ) );
The size is passed to image_downsize()
and there to image_get_intermediate_size()
. If $size
is an array WordPress will search for the best match in existing images:
// from wp-includes/media.php::image_get_intermediate_size()
// get the best one for a specified set of dimensions
if ( is_array($size) && !empty($imagedata['sizes']) ) {
foreach ( $imagedata['sizes'] as $_size => $data ) {
// already cropped to width or height; so use this size
if ( ( $data['width'] == $size[0] && $data['height'] <= $size[1] ) || ( $data['height'] == $size[1] && $data['width'] <= $size[0] ) ) {
$file = $data['file'];
list($width, $height) = image_constrain_size_for_editor( $data['width'], $data['height'], $size );
return compact( 'file', 'width', 'height' );
}