[wp-trac] [WordPress Trac] #26737: WP_Image_Editor should provide a query_formats function.
WordPress Trac
noreply at wordpress.org
Tue Dec 31 01:48:47 UTC 2013
#26737: WP_Image_Editor should provide a query_formats function.
-----------------------------+------------------------------
Reporter: dan.rossiter | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version:
Severity: normal | Resolution:
Keywords: |
-----------------------------+------------------------------
Comment (by dan.rossiter):
Replying to [comment:1 markoheijnen]:
> Why isn't it enough to check if a specific mime type is supported? I'm
not seeing the benefit for returning the formats with a method.
Because that is a less flexible solution. Obviously anything that can be
done by checking for support of an individual extension can be done for
all WP-supported extensions, but sometimes it is cleaner to have access to
the full list.
A specific example of such a case would be a bit of code I'm currently
working on to support generation of thumbnails for arbitrary filetypes.
Each of the many methods of generating a thumbnail is indexed by a regex
matching all supported thumbnails. WP_Image_Editor is one of the ways that
I can generate these thumbnails. With direct access to all supported
extensions I can generate this index with much less overhead than if I
were to iterate all WP-supported extensions and for each get the mime
type, then check whether that mime type is supported.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/26737#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list