media::uploader()

From SkyPHP

Jump to: navigation, search

display an uploader on the page

Contents

Description

uploader ( array $settings )

Parameters

settings - array of settings

REQUIRED:

  • vfolder_path

OPTIONAL:

  • thumb_width
  • thumb_height
  • thumb_crop
  • max_num_files
  • max_file_size (in kilobytes)
  • empty_message
  • file_types
  • file_types_description
  • db_field
  • db_row_id
  • on_success_js
  • context (array of context menu relevant settings)
  • gallery (false will disable gallery view)

context

  • suppress - to prevent default context menu items from being posted
  • html - path to php/html for custom context menu items
  • js - path to javascript for context menu items
  • css - path to css for context menu items

all paths in context are server-side

Return Values

n/a

Examples

Basic Example

media::uploader(array(
    'vfolder_path' => '/person/1234/profile-pics',
    'empty_message' => 'You have not yet uploaded any profile pics.'
));

Context Example

media::uploader(array(
    'vfolder_path' => '/person/1234/profile-pics',
    'context' => array(
         'suppress' => true,
         'html' => '/pages/blog/context.php',
         'js' => '/pages/blog/context.js',
         'css' => '/pages/blog/context.css
    )
));

proposed syntax -- not yet implemented:

media::uploader(array(
    'vfolder_path' => '/person/1234/profile-pics',
    'context_uri' => '/blog/context'
));

Save an upload's media_item_id to a field in the database

media::uploader(array(
    'vfolder_path' => '/person/1234/profile-pics',
    'db_field' => 'person.default__media_item_id',
    'db_row_id' => 1234
));

Note

to use in Google Chrome, include the following javascript files prior to calling the uploader
add_js("/lib/swfupload/swfupload.js");
add_js("/modules/media/upload/handlers.js");
add_js("/pages/media/easyupload/easyupload.js");


See Also

Known Bugs & Issues

n/a

Personal tools