Making WordPress.org

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#825 closed defect (bug) (invalid)

Wrong info for add_image_size() in the Reference

Reported by: vloo's profile vloo Owned by:
Milestone: Priority: normal
Component: Developer Hub Keywords:
Cc:

Description

Width and height parameters of the function are said to be required, but they are actually not. The URL of the error:

https://developer.wordpress.org/reference/functions/add_image_size/

Change History (2)

#1 @Otto42
10 years ago

  • Resolution set to invalid
  • Status changed from new to closed

The default values are zero, and a width and height of zero makes no sense here. The resulting image will have no dimensions and will ultimately get ignored.

Either the width or the height is indeed required to be non-zero, so that the resulting image will have dimensions after scaling. A zero in one dimension will be ignored by the resizing code, but in both dimensions it will have no reference value to scale to.

Therefore, the explanation as given is correct, albeit incomplete.

Regardless of the technicalities of the actual PHP function call, for the function call to be useful or meaningful, one of those two parameters *is* required. The function cannot be called without them, or it will simply do nothing when it comes time to resize the images.

#2 @vloo
10 years ago

Correct me if I'm wrong, but I do believe, that what you say in your last paragraph should be mentioned in the documentation.

Note: See TracTickets for help on using tickets.