Copyright (c) 2008 Mauro Casula (http://www.symfony-framework.com)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
sfSWFUpload - SWFUpload Multi Upload helper
Author
Mauro Casula
Overview
This plugin offers helpers that permit simple use and configuration of SWFUpload: a small JavaScript/Flash library for multi upload.
More info over SWFUpload: http://swfupload.org/
You can use this plugin with included upload action or develop your own upload action.
License
For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
Requirements
The following plugin is required from included sfSWFUpload/upload action (You can create your own):
* sfThumbnailPlugin
Compatibility
Was tested against Symfony version 1.0.7 - 1.0.16
Change log
v0.1.0: First beta release.
Installation
To install the plugin use:
symfony plugin-install http://plugins.symfony-project.com/sfSWFUploadPlugin
copy /plugins/sfSWFUploadPlugin/web/sfSWFUploadPlugin in your web folder.
Configure
Included upload action create the following structure:
galleryFolder/thumbs_folder ( If create_thumb is true )
galleryFolder/images_folder
Basic configuration is done in your application's app.yml file:
app.yml:
#SWF Options
file_size_limit: "100 MB" #Upload file size limit (checked client side)
file_types: "*.jpg;*.gif;*.png" #File types showed by file dialog
file_types_description: "Supported Files" #File types Description
file_upload_limit: 100 #Maximum number of files uploading
file_queue_limit: 0 #Maximum number of files in queue
debug: "false" #Debug flag ( true | false )
#Options for included upload action
image_mime: image/jpeg #Image Mime type. Supported: 'image/jpeg', 'image/png', and 'image/gif'
gallery_folder: uploads/gallery #Gallery Folder ( if not exists, plugin create that )
images_folder: big #Big Images folder
image_width: 800 #Big Images width
image_height: 600 #Big Images height
image_quality: 100 #Big Images Quality
create_thumb: true #If true, create thumbnails with following options
thumbs_folder: small #Thumb Folder
thumb_width: 320 #Thumb Width
thumb_height: 200 #Thumb Height
thumb_quality: 75 #Thumb Quality
Using the plugin
1.Enable the module in your settings.yml if you want to use included upload action:
{{
all:
.settings:
enabled_modules: [sfSWFUpload, ...](default,)
}}
2. Clear the cache
{{
$ symfony cc
}}
3. Put the use_helper in your template
{{
<?php use_helper('sfSWFUpload') ?>
}}
4. Use the helpers:
{{
<?php echo swf_upload_javascript("sfSWFUpload/upload"); ?>
<?php echo swf_upload_standard_html(); ?>
}}
5. Enjoy ;)
Advanced Use
UPLOAD ACTION
This plugin come with a very simple upload action.
You can develop your own upload action and pass it to 'swf_upload_javascript($action)' helper.
LISTENERS
SWFUpload offers a lot of listeners that you can use to offer a better user experience.
Examples:
multiUploadSuccess.php
{{
"NONE"), array()); ?>
$photos, 'small_gallery_dir' => $small_gallery_dir )) ?>
}}
This simple bit of code, make visible a list of uploaded files.
When upload finish, queueComplete funcion is called.. queueComplete in this case is an Ajax function that refresh uploaded files.
There are others 2 built-in examples.
You can enable 'sfSWFUpload' plugin module from settings.yml and watch:
Contacts
If you have any questions or feedback feel free to contact me at maurocasula at gmail.com or contact me from my blog:
www.symfony-framework.com