[wp-trac] Re: [WordPress Trac] #8753: Filter 'upload_dir' is called
excessively for (seemingly) no reason
WordPress Trac
wp-trac at lists.automattic.com
Tue Dec 30 09:11:30 GMT 2008
#8753: Filter 'upload_dir' is called excessively for (seemingly) no reason
--------------------------------------+-------------------------------------
Reporter: ulfben | Owner: anonymous
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.8
Component: General | Version: 2.7
Severity: normal | Resolution:
Keywords: dev-feedback needs-patch |
--------------------------------------+-------------------------------------
Comment (by DD32):
The URL and location of uploaded images are no longer stored in the
database, well, not as absolute paths at least, This is designed to allow
for WordPress installations to be moved between different
hosts/domains/file locations easier.
The URL and Absolute url of images are dynamically created based on the
'basedir' and 'baseurl' results from upload_dir(), For example:
Stored in the database is an attachment, WP stores '2008/12/image-
filename.jpg' as the filename, When it comes time to display it, WP
generates the url by upload_dir() => URL = ['baseurl'] . '2008/12/image-
filename.jpg' => http://...../uploads/2008/... In the event that something
needs to read the actual image, It can locate it by ['basedir'] .
2008/12/image... etc.
I'm pretty sure this was done when it was changed to -not- rely upon
'GUID' for the url of images, GUID in the database will still be set to
the current URL of the image, but it cant be relied upon in the future to
remain the correct url if the WP install changes, or the upload dir
changes, etc.
It looks like it probably wont affect your plugin, other than needing to
short-circuit the filter, since its only using the basedir and baseurl
pieces of the result.
Possibly a context value should be passed for future versions? ie. to tell
the difference between an write and a read? (upload and a display)
--
Ticket URL: <http://trac.wordpress.org/ticket/8753#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list