WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 18 months ago

#23987 closed feature request (worksforme)

add_image_size() shouldn't crop 0 values

Reported by: Clorith Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5.1
Component: Media Keywords:
Focuses: Cc:

Description

When using add_image_size() the image should only be cropped by values that are entered, the following example should only crop the height, and leave the width as the upload original;

add_image_size( 'wide-image', 0, 400, true );

If one uploads a 1600x1600 image, the above should then crop this to 1600x400.

Change History (2)

comment:1 in reply to: ↑ description @andg18 months ago

Not really sure if that should even be a possibility, still if

the image should only be cropped by values that are entered

then 0 as a value for either the height or the width isn't really a good option in my opinion. Since we're basically willing to say "don't crop this dimension", boolean FALSE might be more appropriate.

comment:2 @markoheijnen18 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

What andg says is correct. The current behavior is expected. The one you describe is more add_image_size( 'wide-image', 9999, 400, true ); .

Note: See TracTickets for help on using tickets.