Changeset 47394
- Timestamp:
- 02/29/2020 04:47:44 PM (5 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r47249 r47394 167 167 * Scale an image to fit a particular size (such as 'thumb' or 'medium'). 168 168 * 169 * Array with image url, width, height, and whether is intermediate size, in170 * that order is returned on success is returned. $is_intermediate is true if171 * $url is a resized image, false if it is the original.172 *173 169 * The URL might be the original image, or it might be a resized version. This 174 170 * function won't create a new resized copy, it will just return an already … … 177 173 * A plugin may use the {@see 'image_downsize'} filter to hook into and offer image 178 174 * resizing services for images. The hook must return an array with the same 179 * elements that are returned in the function. The first element being the URL 180 * to the new image that was resized. 175 * elements that are normally returned from the function. 181 176 * 182 177 * @since 2.5.0 183 178 * 184 179 * @param int $id Attachment ID for image. 185 * @param array|string $size Optional. Image size to scale to. Accepts any valid image size,180 * @param string|int[] $size Optional. Image size to scale to. Accepts any valid image size name, 186 181 * or an array of width and height values in pixels (in that order). 187 182 * Default 'medium'. 188 * @return array|false Array containing the image URL, width, height, and boolean for whether 189 * the image is an intermediate size. False on failure. 183 * @return array|false { 184 * Array of image data, or boolean false if no image is available. 185 * 186 * @type string $0 Image source URL. 187 * @type int $1 Image width in pixels. 188 * @type int $2 Image height in pixels. 189 * @type bool $3 Whether the image is a resized image. 190 * } 190 191 */ 191 192 function image_downsize( $id, $size = 'medium' ) { … … 195 196 * Filters whether to preempt the output of image_downsize(). 196 197 * 197 * Passing a truthy value tothe filter will effectively short-circuit198 * down-sizing the image, returning that value as outputinstead.198 * Returning a truthy value from the filter will effectively short-circuit 199 * down-sizing the image, returning that value instead. 199 200 * 200 201 * @since 2.5.0 201 202 * 202 * @param bool $downsize Whether to short-circuit the image downsize. Default false.203 * @param bool|array $downsize Whether to short-circuit the image downsize. 203 204 * @param int $id Attachment ID for image. 204 * @param array|string $size Size of image. Image size or array of width and height values (in that order).205 * Default 'medium'.205 * @param array|string $size Requested size of image. Image size name, or array of width 206 * and height values (in that order). 206 207 */ 207 208 $out = apply_filters( 'image_downsize', false, $id, $size ); … … 933 934 934 935 /** 935 * Retrieve an image to represent an attachment. 936 * 937 * A mime icon for files, thumbnail or intermediate size for images. 938 * 939 * The returned array contains four values: the URL of the attachment image src, 940 * the width of the image file, the height of the image file, and a boolean 941 * representing whether the returned array describes an intermediate (generated) 942 * image size or the original, full-sized upload. 936 * Retrieves an image to represent an attachment. 943 937 * 944 938 * @since 2.5.0 945 939 * 946 940 * @param int $attachment_id Image attachment ID. 947 * @param string| array $size Optional. Image size. Accepts any valid image size, or an array of width941 * @param string|int[] $size Optional. Image size. Accepts any valid image size name, or an array of width 948 942 * and height values in pixels (in that order). Default 'thumbnail'. 949 * @param bool $icon Optional. Whether the image should be treated as an icon. Default false. 950 * @return array|false Returns an array (url, width, height, is_intermediate), or false if no image is available. 943 * @param bool $icon Optional. Whether the image should fall back to a mime type icon. Default false. 944 * @return array|false { 945 * Array of image data, or boolean false if no image is available. 946 * 947 * @type string $0 Image source URL. 948 * @type int $1 Image width in pixels. 949 * @type int $2 Image height in pixels. 950 * } 951 951 */ 952 952 function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) { … … 973 973 } 974 974 /** 975 * Filters the image srcresult.975 * Filters the attachment image source result. 976 976 * 977 977 * @since 4.3.0 978 978 * 979 * @param array|false $image Either array with src, width & height, icon src, or false. 979 * @param array|false $image { 980 * Array of image data, or boolean false if no image is available. 981 * 982 * @type string $0 Image source URL. 983 * @type int $1 Image width in pixels. 984 * @type int $2 Image height in pixels. 985 * } 980 986 * @param int $attachment_id Image attachment ID. 981 * @param string| array $size Size of image. Image size or array of width and height values982 * (in that order). Default 'thumbnail'.983 * @param bool $icon Whether the image should be treated as an icon. Default false.987 * @param string|int[] $size Requested size of image. Image size name, or array of width 988 * and height values (in that order). 989 * @param bool $icon Whether the image should be treated as an icon. 984 990 */ 985 991 return apply_filters( 'wp_get_attachment_image_src', $image, $attachment_id, $size, $icon ); -
trunk/src/wp-includes/post.php
r47358 r47394 6088 6088 6089 6089 /** 6090 * Retrieve the icon for a MIME type .6090 * Retrieve the icon for a MIME type or attachment. 6091 6091 * 6092 6092 * @since 2.1.0
Note: See TracChangeset
for help on using the changeset viewer.