Make WordPress Core

Opened 4 months ago

Last modified 7 weeks ago

#42463 assigned defect (bug)

Poor Description of add_image_size Params

Reported by: miqrogroove Owned by: nikolastoqnow
Milestone: 5.0 Priority: normal
Severity: normal Version: 3.9
Component: Media Keywords: has-patch
Focuses: docs Cc:


From https://core.trac.wordpress.org/browser/tags/4.8/src/wp-includes/media.php#L274

274	 * @param bool|array $crop   Optional. Whether to crop images to specified width and height or resize.
275	 *                           An array can specify positioning of the crop area. Default false.

So it literally says to do one thing or another. But which is what? "Default false" has a meaning, but it is totally lost in this documentation.

Attachments (3)

42463.diff (1009 bytes) - added by nikolastoqnow 4 months ago.
Add better description about crop parameter in add_image_size function
42463.patch (974 bytes) - added by ketuchetan 4 months ago.
42463.2.patch (971 bytes) - added by ketuchetan 4 months ago.

Download all attachments as: .zip

Change History (8)

4 months ago

Add better description about crop parameter in add_image_size function

#1 @nikolastoqnow
4 months ago

  • Keywords has-patch added; needs-patch removed

#2 @ocean90
4 months ago

  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to 5.0
  • Owner set to nikolastoqnow
  • Status changed from new to assigned
  • Version changed from trunk to 3.9

Introduced in [27472].

@nikolastoqnow Thanks for your patch! Looks like an empty line slipped into the patch. The use of "we" should also be avoided.

4 months ago

#3 @ketuchetan
4 months ago

  • Keywords good-first-bug needs-refresh removed

Hi @ocean90 ,

I have made the changes as you requested in @nikolastoqnow patch.

Please let me know if any changes on that.


4 months ago

#4 @miqrogroove
4 months ago

How about adding something to the effect of:

  • Resize to fit one dimension, then crop image to fit the other dimension.
  • Keep source aspect and resize to fit both dimensions, allowing one dimension to become smaller than specified.

This is roughly how I would describe the two different outcomes. And assign them to "true" and "false".

This ticket was mentioned in Slack in #core-media by mike. View the logs.

7 weeks ago

Note: See TracTickets for help on using tickets.