• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: How to let Frontend Users upload images to Gallery
PostPosted: Wed Apr 13, 2011 4:18 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Wed Sep 05, 2007 8:03 pm
Posts: 3999
Location: The Netherlands
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:
Code:
{cms_module module='Uploads' category='Gallery' mode='upload'}


4) Create a new User Defined Tag (UDT)
- Name: UploadToGallery
- Code:
Code:
$addfile = Gallery_utils::AddFileToDB($params['name'], '', Date('Y-m-d H:i:s'), 1, $params['summary'], $params['description']);


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.

_________________


Last edited by Jos on Sun Mar 22, 2015 6:23 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to let Frontend Users upload images to Gallery
PostPosted: Wed Apr 13, 2011 10:26 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Sun Jan 03, 2010 1:58 am
Posts: 56
Wow! My timing is amazing - I just came in to plead with you to create a system for uploading through the front end and found that you had posted this just a few hours ago.

I've created a similar system for uploading through the front end, without benefit of knowing PHP or how to code a UDT, which would no doubt make the whole thing work better. But it does work. It's a bit complicated, so I hope you can follow along. I figured this out by scouring the forum and I appreciate all the suggestions that others have posted in how to get the modules talking to each other.

- I have a site where many different front end users will upload images and I need to be able to keep each user's images separate from the rest.

- I've set up individual folders within Gallery and use their FEU login usernames to name the folders. I use the AE-Gallery to display the images on the users listing.

- I'm using CompanyDirectory to store and display each person's information and use a front end editing form so that they can update their listings. The form includes a custom field called Gallery where I enter the name of their folder. I call the Gallery module using that custom field, like this:

Code:
{if $entry->customfieldsbyname.Gallery ne ''}
<h3>Image Gallery</h3>
{Gallery dir=$entry->customfieldsbyname.Gallery}
{/if}


- In Uploads, I have set up a category for each user and used the value from the companyid field from the CompanyDirectory module as the category name. The server path then directs the images into the Gallery folder set up for the corresponding user, i.e. images/Gallery/username. (For consistency, I would have loved to have used the username for the Uploads category name instead of the companyid but I couldn't figure out how to do that in the time I had.) The code I use in the CD template to handle the upload is :

Code:
{cms_module module="Uploads"  category="$companyid" mode="upload" nocaptcha="1"}


Here's the site: http://www.artsquintewest.ca

Hopefully you're not rolling on the floor laughing by now at how primitive this system is, because it works. Really well.

...except for 3 things...

1. I have set all this up without benefit of a UDT, so it's pretty labour-intensive to add a new user. I'm intending to have a developer write a UDT to automate the process of creating new records in the various modules so that someone else can add new users without all the work it takes now.

2. Without a UDT, I can't get the info in the summary field of the Uploads module into the title file of the Gallery module. I don't want to show the image filenames and my quick and dirty solution was to remove the code that populates the alt tag in AE-Gallery, which of course means that the images don't have any alt information. Not my preferred way of doing things.

3. Regardless of the fact that the users have been asked to resize their images before uploading, they're sending 2 MB images. I was really hoping to find a way to resize the images while they are being uploaded, the way the Gallery module does so beautifully when uploading through the admin. This is why I came on here today to plead with you to create a way to do that.

Any thoughts on whether it's possible to get these images resized as they're being uploaded? I've used Jeremy Bass's SuperSizer module on another site and it works well but I haven't looked into whether it might work in this situation. However, with that module, the images are still uploaded in their huge size and then resized, and saved with a lot of extra numbers in the filenames. So the original images are still there and the filenames are confusing. I really love the way Gallery does the resizing during the upload so that the server space doesn't get filled up with huge, unused files. I've taken a quick look at Calguy's new SmartImage toolkit but as far as I can tell, it also affects only the output and I haven't yet figured out whether I can incorporate it into this system.

So - does the process of adding the file using your UploadToGallery UDT do any resizing or does it simply place the file in the Gallery folder? Is it even possible to do this kind of resizing? Does anyone else have any thoughts on how I might accomplish this? Or am I doomed to spending hours teaching people how to resize their images before uploading?

Grateful for any assistance and/or guidance,
Penny


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to let Frontend Users upload images to Gallery
PostPosted: Fri May 06, 2011 2:03 pm 
Offline
Forum Members
Forum Members

Joined: Tue Jan 11, 2011 3:22 pm
Posts: 69
Hi fellows,

I am using the upload module but i have a serious question about it.
When somebody has uploaded an image i dont get my thank you page wich i have made.

How do i get it????


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to let Frontend Users upload images to Gallery
PostPosted: Sat May 07, 2011 11:47 pm 
Offline
Forum Members
Forum Members

Joined: Sat Jan 10, 2009 6:59 pm
Posts: 22
Perfect! Thank you Jos. It's what I've been looking for.

I have a question though, how can I retrieve all the images uploaded by a specific user when I'm using CG User Directory? Does anyone know how to accomplish this?


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to let Frontend Users upload images to Gallery
PostPosted: Fri Oct 21, 2011 11:23 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Fri Nov 30, 2007 9:15 am
Posts: 346
Thx for sharing Jos!!

Greetings,
Manuel


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to let Frontend Users upload images to Gallery
PostPosted: Thu Oct 11, 2012 9:46 am 
Offline
Forum Members
Forum Members

Joined: Wed Oct 26, 2011 11:01 am
Posts: 13
Hello,

viewtopic.php?f=7&t=63430

Help please ;)


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to let Frontend Users upload images to Gallery
PostPosted: Thu Oct 11, 2012 10:03 am 
Offline
Support Guru
Support Guru
User avatar

Joined: Wed Sep 05, 2007 8:03 pm
Posts: 3999
Location: The Netherlands
viewtopic.php?f=34&t=62510&p=287775#p287775

_________________


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to let Frontend Users upload images to Gallery
PostPosted: Tue Jul 30, 2013 1:13 pm 
Offline
Forum Members
Forum Members

Joined: Fri May 04, 2012 1:53 pm
Posts: 15
Location: London
I'm also having problems getting a page to show after the file has uploaded.

Although the URL is correct, it only shows the 'live' text that's on the page - none of the rest of the site template or Gallery scripts that are on the page.

If I 'refresh' the page, it asks me to re-send the form. On cancelling this, the page does eventually load correctly.

Probably something simple I'm doing wrong (as ever!), but any help would be much appreciated.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to let Frontend Users upload images to Gallery
PostPosted: Sun Mar 22, 2015 4:14 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Apr 23, 2008 7:53 am
Posts: 7500
Location: The Netherlands
Related viewtopic.php?f=7&t=72572

_________________
Image

Did my post help you solving a problem at your (customers) website and it saved you many hours of work? Great!! Consider buying me a cup of coffee in return! [ Click here ]



Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
HostPapa CMS Made Simple hosting