[wp-trac] [WordPress Trac] #19110: Media File Url

WordPress Trac wp-trac at lists.automattic.com
Thu Nov 3 10:39:54 UTC 2011


#19110: Media File Url
-------------------------+------------------------------
 Reporter:  braydonf     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Media        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------

Comment (by braydonf):

 = Possible Solutions =


 == A: New Column ==

 New column '''post_media''' in the '''wp_posts''' table, this would not
 only be useful for attachments but for any custom post type that requires
 video audio or photos. Currently plugins like NextGen (
 http://wordpress.org/extend/plugins/nextgen-gallery/ ) define an entirely
 new table to store photos, while photos, galleries and albums do not
 support many features of posts such as post status, publish date.

 {{{
 ID
 post_author
 post_date
 post_date_gmt
 post_content
 post_media
 post_title
 post_excerpt
 post_status
 comment_status
 ping_status
 post_password
 post_name
 to_ping
 pinged
 post_modified
 post_modified_gmt
 post_content_filtered
 post_parent
 guid
 menu_order
 post_type
 post_mime_type
 comment_count
 }}}

 This would leave the GUID column open to be used to store with either the
 attachment permalink as consistent with posts GUID. Though GUID is not
 supported to be a permalink, a permalink just happens to be a collision
 free identifier, though lacks ability to move between domains. The GUID
 field could also be used to store a random UUID version 4.

 == B: Post Meta ==

 Add new functions to handle setting and retrieving the media url, in the
 same way that there are functions for dealing with post thumbnails.

 {{{
 get_the_post_media
 has_post_media
 the_post_media
 get_post_media_id

 get_the_post_thumbnail
 has_post_thumbnail
 the_post_thumbnail
 get_post_thumbnail_id
 }}}

 == C: New Table ==

 To simplify the namespace of post thumbnails and media, to use an object
 to handle more than one one types of media for a post. Keys could be used
 such as "thumbnail". The API could handle images, video, audio and in
 addition just files. Each type would be handled differently. Stored in a
 new table ( http://codex.wordpress.org/Database_Description ) that is
 specifically for media. This new table could be '''wp_media''':


 {{{
 media_id - incremented integer
 media_key
 post_id - relational to wp_posts ID
 media_type - image, video or audio
 media_mime_type - file type
 media_path - path to the media relative to the upload directory
 media_size - size in bytes
 media_dimensions - length of the media or dimensions for images
 media_order - for tracks
 media_meta - any metadata, such as ID3 or EXIF
 }}}

 The media library and attachments could be written to use this, in
 addition to making these available for custom post types for handling
 audio, video and images. Post thumbnails could also be written to use this
 for simplicity.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19110#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list