How to let Frontend Users upload images to Gallery
Posted: Wed Apr 13, 2011 4:18 pm
A frequently requested feature for Gallery is to give frontend users the ability to upload images to Gallery.
I demonstrated how this can be done with the Uploads module at the Geekmoot 2010 and also at the 4th Dutch CMS Made Simple Workshop.
So if you want to give Frontend users a form where they can select an image from their computer and enter their own title and comment, this is how to do that in 5 easy steps:
1) install the Uploads module (depends on CGExtensions)
2) Go to the Uploads admin area and create a new category
- Category Name: Gallery
- Description: Upload to Gallery
- Server Path: images/Gallery
3) create a new content page for the upload-form with this code in the content field:
4) Create a new User Defined Tag (UDT)
- Name: UploadToGallery
- Code:
5) Go to Extensions -> Event Manager, Set Filter By Module to Uploads and select the OnUpload event. Then select the UploadToGallery UDT and add it to this event
At this point you have the Gallery Frontend Upload Form running!
You can change the looks of the uploadform in the Upload admin area (click "Modify Templates", tab Upload Templates)
Note:
- It is not possible to use the uploadfunction that is integrated in Gallery
- It is not possible to use another Gallery subdirectory, due to the (lack of) params sent out by Uploads with the OnUpload event.
I demonstrated how this can be done with the Uploads module at the Geekmoot 2010 and also at the 4th Dutch CMS Made Simple Workshop.
So if you want to give Frontend users a form where they can select an image from their computer and enter their own title and comment, this is how to do that in 5 easy steps:
1) install the Uploads module (depends on CGExtensions)
2) Go to the Uploads admin area and create a new category
- Category Name: Gallery
- Description: Upload to Gallery
- Server Path: images/Gallery
3) create a new content page for the upload-form with this code in the content field:
Code: Select all
{cms_module module='Uploads' category='Gallery' mode='upload'}
- Name: UploadToGallery
- Code:
Code: Select all
$addfile = Gallery_utils::AddFileToDB($params['name'], '', Date('Y-m-d H:i:s'), 1, $params['summary'], $params['description']);
At this point you have the Gallery Frontend Upload Form running!
You can change the looks of the uploadform in the Upload admin area (click "Modify Templates", tab Upload Templates)
Note:
- It is not possible to use the uploadfunction that is integrated in Gallery
- It is not possible to use another Gallery subdirectory, due to the (lack of) params sent out by Uploads with the OnUpload event.