media
From SkyPHP
The media class is used to manage user-uploaded files.
Contents |
PHP Functions
- media::gallery() - display a photo gallery of items in a specific vfolder
- media::get_item() - return an array for the specific media item
- media::get_random_item() - return an array for a random item in a vfolder
- media::get_vfolder() - return an array of items in a vfolder
- media::new_item() - import a file (local or remote) into a vfolder
- media::uploader() - display an upload button and the contents of a specific vfolder
- media::zip() - compress the contents of a vfolder into a zip file
Media Items
Any type of file can be uploaded. Every media item must be saved to a vfolder.
Vfolders
Vfolders can be identified by either a) the media_vfolder_id, or b) the vfolder_path. The vfolder path must always begin with a forward slash "/".
Often, you need to create media folders for records in the database. You should name your vfolder the same as your table name.
$vfolder_path = "/person/{$person_id}";
# example: /person/123
Resizing, Cropping, and Image Quality
media::get_item() and other functions (see above) allow you to specify the image dimensions and image quality. This way you can upload hi-res images, and create thumbnails automatically.
Known Bugs & Issues
- get_item() does not display flash in a skybox
- separate original uploaded files from resizes - allows rsync of originals only
- top level folder should be used to segment different websites/accounts
- media_distro should be for reference, but other servers may have the file
- get_item - option to use full domain instead of relative url
- global image skybox
- CDN mode for a media_host
