Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#9922 closed defect (bug) (fixed)

wp_crop_image() and image_resize() are inconsistent. Both should return WP_Error objects on error.

Reported by: mdawaffe Owned by: westi
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch early
Focuses: Cc:


wp_crop_image() returns a string on error. resize_image() returns a WP_Error object.

Both use wp_load_image() and should have consistent return values.

Attached. Assigned to 2.9. 2.8?

I also think wp_load_image() should return a WP_Error object instead of a string on error, but maybe that's a separate ticket.

Attachments (1)

9922.diff (2.8 KB) - added by mdawaffe 13 years ago.

Download all attachments as: .zip

Change History (5)

13 years ago

#1 @mdawaffe
13 years ago

  • Keywords has-patch dev-feedback added

#2 @Denis-de-Bernardy
12 years ago

  • Keywords WP_Error dev-feedback removed


#3 @westi
12 years ago

  • Keywords early added
  • Milestone changed from 2.9 to 3.0
  • Owner set to westi
  • Status changed from new to accepted

This sounds like a good idea to me.

I am wary of changing the return value of a function this close to release - would have rather done this pre-beta to make sure plugin authors had a chance to catch anywhere they are relying on current behaviour.

We should also change wp_load_image to return a WP_Error at the same time I agree.

#4 @ryan
12 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [12524]) Retunr WP_Error from wp_crop_image() and image_resize(). Props mdwaffe. fixes #9922

Note: See TracTickets for help on using tickets.