Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#9672 closed enhancement (wontfix)

Better filtering for image_downsize()

Reported by: scribu's profile scribu Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7.1
Component: Media Keywords: has-patch
Focuses: Cc:

Description

Currently, the image_downsize filter doesn't pass the computed data array.

So, for example, if a plugin wants only to change the image src, it has to copy the entire image_downsize() function in order to compute the other fields: $width, $heigh and $is_intermediate.

Attachments (1)

image_downsize.patch (1014 bytes) - added by scribu 16 years ago.
apply the filter at the end

Download all attachments as: .zip

Change History (11)

@scribu
16 years ago

apply the filter at the end

#1 @scribu
16 years ago

  • Version set to 2.7.1

#2 follow-up: @Denis-de-Bernardy
16 years ago

the current patch changes the semantics of the existing patch. if a plugin relies on it and checks for !== false before doing its stuff, that plugin will break. so we might want to use add a different hook instead.

#3 @Denis-de-Bernardy
16 years ago

  • Keywords 2nd-opinion added

#4 in reply to: ↑ 2 @scribu
16 years ago

Replying to Denis-de-Bernardy:

the current patch changes the semantics of the existing patch. if a plugin relies on it and checks for !== false before doing its stuff, that plugin will break. so we might want to use add a different hook instead.

If the plugin relies on !== false, it means that it will also conflict with another plugin that uses the hook.

So it's not a very good plugin, not because of it's author, but because of the suboptimal way this filter has been applied. Hence the need for this patch.

#5 @scribu
16 years ago

So, to answer your concern, I think it should be the same hook, so that plugin authors are not tempted to rely on quirky behaviour.

#6 @Denis-de-Bernardy
16 years ago

  • Keywords 2nd-opinion removed

Well, not exactly. If I were to hook onto the existing hook, personally, I'd make sure I don't change something that has already been generate -- so as to *not* conflict with existing plugins.

But I seem your point, yeah.

#7 @Denis-de-Bernardy
16 years ago

  • Keywords commit added

patch still works against trunk. please commit or wontfix to trim ticket clutter.

#8 follow-up: @azaozz
16 years ago

  • Milestone changed from 2.8 to 2.9

There are hooks like that in several places. They allow a plugin to skip the rest of the function by providing output (similar to how pluggable.php works).

Not sure what the end result will be if there are 3-4 plugins all doing image_downsize at the same time...

#9 @Denis-de-Bernardy
16 years ago

  • Keywords reporter-feedback added; commit removed

#10 in reply to: ↑ 8 @scribu
16 years ago

  • Keywords reporter-feedback removed
  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Replying to azaozz:

There are hooks like that in several places. They allow a plugin to skip the rest of the function by providing output (similar to how pluggable.php works).

Not sure what the end result will be if there are 3-4 plugins all doing image_downsize at the same time...

Ok, I'm obviously barking at the wrong tree. This probably isn't the hook I should be using anyway.

Note: See TracTickets for help on using tickets.