diff --git a/wp-includes/media.php b/wp-includes/media.php index 95c52c070..6137e9b85 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -1,8 +1,36 @@ tag. Empty values will be omitted. +/** + * Retrieve width and height attributes using given width and height values. + * + * Both attributes are required in the sense that both parameters must have a + * value, but are optional in that if you set them to false or null, then they + * will not be added to the returned string. + * + * You can set the value using a string, but it will only take numeric values. + * If you wish to put 'px' after the numbers, then it will be stripped out of + * the return. + * + * @since 2.5.0 + * + * @param int|string $width Optional. Width attribute value. + * @param int|string $height Optional. Height attribute value. + * @return string HTML attributes for width and, or height. + */ function image_hwstring($width, $height) { $out = ''; if ($width) @@ -54,10 +98,25 @@ function image_hwstring($width, $height) { return $out; } -// Scale an image to fit a particular size (such as 'thumb' or 'medium'), and return an image URL, height and width. -// The URL might be the original image, or it might be a resized version. This function won't create a new resized copy, it will just return an already resized one if it exists. -// returns an array($url, $width, $height, $is_intermediate) -// $is_intermediate is true if $url is a resized image, false if it is the original +/** + * Scale an image to fit a particular size (such as 'thumb' or 'medium'). + * + * Array with image url, width, height, and whether is intermediate size, in + * that order is returned on success is returned. $is_intermediate is true if + * $url is a resized image, false if it is the original. + * + * The URL might be the original image, or it might be a resized version. This + * function won't create a new resized copy, it will just return an already + * resized one if it exists. + * + * @since 2.5.0 + * @uses apply_filters() Calls 'image_downsize' on $id and $size to provide + * resize services. Should return true if resizes. + * + * @param int $id Attachment ID for image. + * @param string $size Optional, default is 'medium'. Size of image, can be 'thumbnail'. + * @return bool|array False on failure, array on success. + */ function image_downsize($id, $size = 'medium') { if ( !wp_attachment_is_image($id) ) @@ -109,6 +168,8 @@ function image_downsize($id, $size = 'medium') { * * {@internal Missing Long Description}} * + * @since 2.5.0 + * * @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 @@ -207,7 +268,18 @@ function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop=false } -// Scale down an image to fit a particular size and save a new copy of the image +/** + * Scale down an image to fit a particular size and save a new copy of the image. + * + * @param unknown_type $file + * @param unknown_type $max_w + * @param unknown_type $max_h + * @param unknown_type $crop + * @param unknown_type $suffix + * @param unknown_type $dest_path + * @param unknown_type $jpeg_quality + * @return unknown + */ function image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_path=null, $jpeg_quality=90) { $image = wp_load_image( $file ); @@ -482,14 +554,33 @@ function gallery_shortcode($attr) { return $output; } +/** + * Display previous image link that has the same post parent. + * + * @since 2.5.0 + */ function previous_image_link() { adjacent_image_link(true); } +/** + * Display next image link that has the same post parent. + * + * @since 2.5.0 + */ function next_image_link() { adjacent_image_link(false); } +/** + * Display next or previous image link that has the same post parent. + * + * Retrieves the current attachment object from the $post global. + * + * @since 2.5.0 + * + * @param bool $prev Optional. Default is true to display previous link, true for next. + */ function adjacent_image_link($prev = true) { global $post; $post = get_post($post);