[wp-trac] [WordPress Trac] #51780: Add ability to easily get path to sized images (such as parameter to get_attached_file() or wp_get_attachment_thumb_file())
WordPress Trac
noreply at wordpress.org
Fri Feb 24 00:08:19 UTC 2023
#51780: Add ability to easily get path to sized images (such as parameter to
get_attached_file() or wp_get_attachment_thumb_file())
--------------------------------------------------+------------------------
Reporter: paulschreiber | Owner: joedolson
Type: enhancement | Status: reopened
Priority: normal | Milestone: 6.2
Component: Media | Version: 5.5.3
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests 2nd-opinion | Focuses:
--------------------------------------------------+------------------------
Changes (by azaozz):
* keywords: has-patch has-unit-tests commit => has-patch has-unit-tests
2nd-opinion
* status: closed => reopened
* resolution: fixed =>
Comment:
Not sure this is a good addition to `get_attached_file()`. This function
should **get the attached file**, i.e. a PDF, a video, an image, etc. What
is the point to extend it only for images? That seems confusing :(
Also, looking at the description, there is no reason why this is needed.
If there is really a good reason for such function, it should probably be
a new function.
However I don't see a reason why plugin authors cannot use
`image_get_intermediate_size()` for this. That's probably currently used
anyways.
Another serious objection here is that this patch slows down
`get_attached_file()` as it always does another DB request, no matter what
file is attached.
In my opinion this patch should be reverted and moved to 6.3 or future
release allowing for a better review whether this is really needed, and
for better patch (new function) that doesn't reduce performance of
get_attached_file()`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51780#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list