WordPress.org

Make WordPress Core

#27675 closed enhancement (wontfix)

WP_Image_Editor_Imagick and WP_Image_Editor_GD should allow access to $image

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

Description

Both WP_Image_Editor_Imagick and WP_Image_Editor_GD have a resource in $image, which is protected. I know that the whole point is to offer a wrapper for these, but it seems like creating an access method for it would make sense for those edge cases. In my case I needed to blur an image.

Change History (3)

comment:1 @DH-Shredder11 months ago

In these edge cases, I'd suggest extending the editor you need to either add a blur method, or add an accessor.

Indeed, the entire point of the abstraction is to not allow direct access.

comment:2 @markoheijnen11 months ago

  • Keywords close added

I would close it as wont-fix since the resource $image can't be public since the value isn't the same. We could create a getter that always returns a GD resource but that feels like a ugly hack.

comment:3 @aaroncampbell11 months ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Yeah, I gave it some more thought and decided it's not super helpful. The logic for dealing with a resource when you don't know if it's GD or Imagick is already pretty complex so you might as well just extend the existing classes (which is what I ended up doing anyway).

Note: See TracTickets for help on using tickets.