From f657d4cb643c048c0c32f59c3022bb14238ae4ce Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 31 May 2008 19:12:55 +0000 Subject: [PATCH] New filter and phpdoc for get_image_tag(). Props jacobsantos. fixes #7065 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@8029 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index 23bcdf364c..fd4b0a2a3c 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -90,13 +90,32 @@ function image_downsize($id, $size = 'medium') { } -// return an tag for the given image attachment, scaling it down if requested +/** + * An tag for an image attachment, scaling it down if requested. + * + * {@internal Missing Long Description}} + * + * @uses apply_filters() The 'get_image_tag_class' filter is the IMG element + * class attribute. + * @uses apply_filters() The 'get_image_tag' filter is the full IMG element with + * all attributes. + * + * @param int $id Attachment ID. + * @param string $alt Image Description for the alt attribute. + * @param string $title Image Description for the title attribute. + * @param string $align Part of the class name for aligning the image. + * @param string $size Optional. Default is 'medium'. + * @return string HTML IMG element for given image attachment + */ function get_image_tag($id, $alt, $title, $align, $size='medium') { list( $img_src, $width, $height ) = image_downsize($id, $size); $hwstring = image_hwstring($width, $height); - $html = ''.attribute_escape($alt).''; + $class = 'align'.attribute_escape($align).' size-'.attribute_escape($size).' wp-image-'.$id; + $class = apply_filters('get_image_tag_class', $class, $id, $align, $size); + + $html = ''.attribute_escape($alt).''; $html = apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );