Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#17475 closed defect (bug) (fixed)

Custom cropping in image-edit.php doesn't work with custom image sizes

Reported by: mau's profile mau Owned by: nacin's profile nacin
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.2
Component: Media Keywords: 2nd-opinion has-patch
Focuses: Cc:

Description

Custom (manual) cropping in image-edit.php doesn't work with custom image sizes (sizes added via add_image_size).

wp-admin/includes/image-edit.php#L606
There's an 'intermediate_image_sizes' filter hook where default image sizes are hard-coded in an array.
Sure you can add your own custom sizes to the array via this filter but it seems to me that having to use the filter every time you use add_image_size() doesn't feel right. Especially when the radio button below says: "Apply changes to: All image sizes".

I believe it could be fine to replace the 'intermediate_image_sizes' filter with call to get_intermediate_image_sizes() function.
This would not break the filtering ability the hook provided as the same hook is used in the mentioned function as well.

How do you feel about it?

This is the very first patch proposal in my life. Please be kind. I'm sorry if I misunderstood something.

Attachments (1)

image-edit.php.diff (604 bytes) - added by mau 13 years ago.

Download all attachments as: .zip

Change History (7)

@mau
13 years ago

#1 @mau
13 years ago

  • Keywords 2nd-opinion has-patch added

#2 @mau
13 years ago

  • Severity changed from minor to normal

#3 @SergeyBiryukov
13 years ago

  • Milestone changed from Awaiting Review to 3.3

#4 @nacin
13 years ago

This patch looks sane. Given that this code is even running the function's filter, there should be limited side effects.

#5 @nacin
13 years ago

Looks like this was simply missed in [12659].

#6 @nacin
13 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [18996]:

Use get_intermediate_image_sizes() in image edit functions. props mau, fixes #17475.

Note: See TracTickets for help on using tickets.