Edit photo info on upload

missoni

Joined: 2013-09-06
Posts: 13
Posted: Fri, 2013-09-06 21:35

Hey!
Is there a built-in way to edit photo information (title, description etc.) right after uploading it? I want the user to upload and set up photo's title & position in one step. By default, it seems, the user uploads and then has to edit the image, which deviates from the standard online galleries' behavior.

Thanks in advance for any suggestions!
Pavlo

 
MikeLFD

Joined: 2013-03-22
Posts: 79
Posted: Sat, 2013-09-07 04:22

yes
go here http://galleryproject.org/node/111725
look down the replies and download mobile uploader.zip

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sun, 2013-09-08 00:01

Also: http://codex.galleryproject.org/Gallery3:Modules:captionator

Side note: It's best to edit your exif data BEFORE you upload the photos; then Gallery (and many other sites/software) can auto-import the info when you upload.

 
missoni

Joined: 2013-09-06
Posts: 13
Posted: Sun, 2013-09-08 20:37

Thanks for your fast support guys!

Quote:
look down the replies and download mobile uploader.zip

This is almost what I was looking for, but I need to edit title/description _after_ the image has been uploaded. The idea is to allow user input after the EXIF tags have been extracted. If title/description have been set prior to upload, then these values should be displayed in the edit fields. Is there perhaps a module for that?

Quote:
Side note: It's best to edit your exif data BEFORE you upload the photos; then Gallery (and many other sites/software) can auto

That's true for a personal album, but not when the gallery is designed for many different users. In that case, it is better to design a workflow which forces users to enter title/description if they are not available via tags.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2013-09-08 21:38
Quote:
edit title/description _after_ the image has been uploaded

If the user has permissions to add then they have permissions to edit the item.
Perhaps the captionator module is what you are after.

dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Mon, 2013-09-09 00:21

Have you looked at the linked I posted above? "Also: http://codex.galleryproject.org/Gallery3:Modules:captionator"

missoni wrote:
If title/description have been set prior to upload, then these values should be displayed in the edit fields.

Did you activate the exif module?

Also: http://sourceforge.net/apps/trac/gallery/ticket/608

 
missoni

Joined: 2013-09-06
Posts: 13
Posted: Thu, 2013-09-12 18:19

@floridave, @tempg:
Thanks for your effort, guys, but it seems that I express myself wrong. What I am trying to achieve is to trigger edit_item_dialog right after an image has been uploaded. Is this possible?

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Thu, 2013-09-12 20:15
missoni wrote:
What I am trying to achieve is to trigger edit_item_dialog right after an image has been uploaded. Is this possible?

Possible, but will require you to do a fair bit of coding.
Unless your users are uploading on photo at a time, you'd have to design/code a complete captioning system and THEN get that to trigger when the images are uploaded. You could also maybe edit the captionator module to auto trigger at upload and only display editing options for the images uploaded.
Last bit, I think that some work was done on the uploader for G3.1, but I haven't followed it closely enough to know what all of the changes/enhancements are; you may want to take a look for a heads up.

 
missoni

Joined: 2013-09-06
Posts: 13
Posted: Fri, 2013-09-13 13:31
tempg wrote:
Possible, but will require you to do a fair bit of coding.

I am ready! I found this manual: http://codex.galleryproject.org/Gallery3:Developer_Handbook:Event_Hooks. Could you perhaps provide me with an example? I am not familiar with programming for Gallery3, but I have to give it my best.

I will limit my use case to uploading only one file at a time first. In that case, I guess, I can use the existing HTML uploader, but limit the number of files to one for simplicity. How do I catch the event after one photo has been successfully uploaded to server? Do I have to program a new controller or should I connect myself onto the existing one (Uploader_Controller)?

Thanks in advance for any help!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-09-13 14:47

The auto rotate module 'listens' for the the item_created() event. Look at the item_created function in the modules helper file; autorotate_event.php

You are doing what I would do, modify the html uploader, add a helper to listen for the item to be created, close that modal window and launch a new modal window with the edit dialog or similar.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
missoni

Joined: 2013-09-06
Posts: 13
Posted: Fri, 2013-09-13 18:07

Until now I managed to catch item_created & add_photos_form_completed events. I can also generate my own edit_item_form event, but contrary to my expectations this does not trigger the "edit photo" dialog to appear. At the moment I see a possibility to generate my own edit photo dialog, but I would rather use the built-in functionality of Gallery3. Is this possible?

My code looks like following:
html_uploader/helpers/html_uploader_event.php:

class html_uploader_event {
  static function add_photos_form_completed($item, $form) {      
      Kohana_Log::add("error", "@todo autorotate_event::add_photos_form_completed() succeeded: " . $item->url());
      
      module::event("edit_item_form", $item, photo::get_edit_form());
  }
  
  static function edit_item_form($item,$form) {
      Kohana_Log::add("error", "@todo autorotate_event::edit_item_form() succeeded: " . $item->url());
  }
}  

Both events are logged, so I know that they occur. Is there a possibility to open the built-in edit photo dialog? Removing edit_item_form(..) function does not redirect the event to the gallery core.

Thanks in advance for your help!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-09-13 21:17

I think you could add the link to the dialog on the bottom of the form:
<a class="g-dialog-link " href="/gallery3/index.php/form/edit/photos/3?from_id=3"> Edit photo </a>
and then in the item_created function fire off that link with jquery?
I'm no JSON expert but i bet there is a gallery function already that could close the existing dialog and open another at the same time. I guess that might be hard to do on the server side with PHP and have a client side event...

Another option is to see how the original dialog is opened to change your password when you first install gallery. It pops up a dialog without user intervention.

Dave
____________________________________________
Blog & G2 || floridave - Gallery Team

 
missoni

Joined: 2013-09-06
Posts: 13
Posted: Sun, 2013-09-15 13:24
Quote:
in the item_created function fire off that link with jquery

I guess that the item's id is still unknown in the add_item_form. The photo has not been uploaded until then.

Quote:
Another option is to see how the original dialog is opened to change your password when you first install gallery. It pops up a dialog without user intervention.

How would you look that up? What part of core functionality is that?

Thanks!