#34257 closed defect (bug) (fixed)
Wrong order of width and height in image functions $size param descriptions
Reported by: | jaspermdegroot | Owned by: | DrewAPicture |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch |
Focuses: | docs | Cc: |
Description
The image functions that accept an array with the image dimensions as argument for the $size
parameter have a description of this parameter that says "a flat array of height and width values". This should be "width and height" since $size[0]
has to be the width.
Affected functions in 'wp-includes/media.php':
image_constrain_size_for_editor
(change "array of sizes" to "flat array of width and height values")image_downsize
get_image_tag
image_get_intermediate_size
wp_get_attachment_image_src
(also in the filter description)wp_get_attachment_image
wp_get_attachment_image_url
gallery_shortcode
: (@type $size description doesn't mention that it also accepts an array)previous_image_link
next_image_link
adjacent_image_link
In 'wp-includes/post-template.php':
wp_get_attachment_link
(change "@param string $size" to "@param string|array $size" and "either array or string" to "either string or flat array of width and height values")
The following functions in 'wp-includes/media.php' have a description of the $crop
parameter with "specified height and width" in it. Although this isn't wrong, it might be better to change this to "width and height" as well to match the order of the parameters and for consistency.
add_image_size
set_post_thumbnail_size
image_resize_dimensions
(also in the filter description)image_make_intermediate_size
Change History (52)
#1
@
9 years ago
- Focuses docs added
- Keywords needs-patch added
- Type changed from defect (bug) to enhancement
- Version trunk deleted
#3
@
9 years ago
- Milestone changed from Awaiting Review to 4.4
- Type changed from enhancement to defect (bug)
#8
@
9 years ago
@DrewAPicture
Thanks for fixing this!
Some of the responsive image functions that have been added for 4.4.0 also have a $size
parameter that accepts an array of width and height values. This info is missing in the DocBlock. I am working on that with @joemcgill. See https://github.com/jaspermdegroot/develop.wordpress/commit/7c86df844e72b73f7cbf2057c1c8a38cef6ca1a3
#9
@
9 years ago
- Keywords has-patch added; needs-patch removed
In [35035], the referenced hook name should be image_downsize
. Whoops.
#45
@
9 years ago
@jaspermdegroot That covers everything you listed and more that I found. Thanks for pointing that out! Let's do the responsive images-related docs adjustments in a new ticket.
#46
@
9 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Missed adding array
type to some of the earlier ones.
In 35033: