Home > Support > Forum

Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Select gallery on upload page

UserPost

8:08 am
December 1, 2009


Chanty

Member

posts 5

1

Hi,

I recently installed NGG Public Uploader and it almost perfectly suits my needs. The one thing that's missing is the ability to let users choose the gallery they want to upload to, instead of choosing a default one. I already have 9 existing galleries and I'd like my users to choose the right one for their uploads, how do I achieve this?

Thanks a bunch in advance :)

10:36 am
December 1, 2009


Chanty

Member

posts 5

2

Never mind, I put my PHP knowledge to the test and managed to add a little dropdown menu myself!

Here's the code if anyone's interested, I put this in place of line 243 in inc/npu-upload.php:

include_once (NGGALLERY_ABSPATH.”lib/ngg-db.php”);
                $nggdb = new nggdb();
                   $gallerylist = $nggdb->find_all_galleries('gid', 'ASC');
               
                $strOutput .= “\n<div id=\”choosegallery\” style=\”margin: 10px 0 0 0;\”>”;
                $strOutput .= “\n<select id=\”npu_upload-id-$gal_id\” name=\”galleryselect\”>
                               \n<option value=\”0\”>Choose category</option>
                               \n<option value=\”\”>&nbsp;</option>”;
                   foreach ($gallerylist as $gallery) {
                $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
                $strOutput .= “\n<option value=\”$gallery->gid\”>$name</option>”; }
                $strOutput .= “</select>”;
                $strOutput .= “\n</div>”;

Smile


8:24 pm
December 7, 2009


WDS-Scott

Admin

posts 53

3

Awesome! Thanks for the “how-to”. I'll incorporate this in a future release of the plugin and until then send people here for the patch.

Thanks again,

-Scott

12:30 pm
December 8, 2009


castvision

Member

posts 7

4

Hi there

Just loaded the plugin in the hopes of doing the above but not working on mine, it sends the template off

Not familiar with PHP so perhaps doing something wrong!!?

3:37 pm
December 10, 2009


Chanty

Member

posts 5

5

WDS-Scott said:

Awesome! Thanks for the “how-to”. I'll incorporate this in a future release of the plugin and until then send people here for the patch.

Thanks again,

-Scott


No problem! It's not optimal code though, it apparently gives an error when uploading the same file (not sure if that's related to the plugin itself or just a lack of proper error code handling for my code) and whenever you don't select a gallery, I'm guessing that's because I got rid of the default gallery setting in my code. But glad to have helped :)


@ castvision; did you copy & paste the code in place of the code on line 243?

5:41 am
December 12, 2009


Valkrider

Member

posts 6

6

Post edited 10:43 am – December 12, 2009 by Valkrider


It may be me but I can't get this code to work either. line 243 for me just contains a }


This is the code from lines 240 to 250 according to my editor

[code]

    echo $strOutput;
            } else {
                return $strOutput;
            }          
        }
       
        // Function: Widget Form
        public function display_uploader_widget($gal_id, $strDetailsPage = false, $blnShowAltText = true, $echo = true) {   
            $strOutput = "";
            if (count($this->arrErrorMsg_widg) > 0) {

[/code]


Is this really the correct place?

3:52 pm
December 12, 2009


Chanty

Member

posts 5

7

This is what's on line 243 (in version 1.4)


$strOutput .= “\n<input type=\”hidden\” name=\”galleryselect\” value=\”{$gal_id}\”>”;

It's on line 211 in 1.5 :)

6:02 am
December 13, 2009


Valkrider

Member

posts 6

8

Post edited 11:03 am – December 13, 2009 by Valkrider


Cry If I replace line 2.11 in 1.5 it stops my blog working completely.


Embarassed My php skills are not up to resolving this so I have had to revert to the vanilla version unfortunately.


I suspect it may be incompatibility with the theme I am using (Suffusion) but I don't want to change the theme so I will have to stick with v1.5 unmodified unless you can suggest an alternative way of achieving the same outcome.

3:36 am
December 14, 2009


castvision

Member

posts 7

9

line 244 on mine


Works a treat


Chanty big thanks for providing the code and the code it replaces Cool Smile

3:32 am
December 15, 2009


castvision

Member

posts 7

10

Spoke to soon I'm afraid, added a gallery and it went back to throwing my template out Cry


Any suggestions would be very much appreciated?


In the meantime I'll see if any thing makes sense to me, damn wish I knew PHP!

2:20 pm
December 16, 2009


Chanty

Member

posts 5

11

castvision said:

line 244 on mine


Works a treat


Chanty big thanks for providing the code and the code it replaces Cool Smile


Ah yes, there are two of that line in 1.5. Do you just get a blank page then? I'm not sure what other changes have been made to the code in 1.5, so something else may be needing that line…

11:54 am
December 17, 2009


castvision

Member

posts 7

12

Hi Chanty


No not blank a screendump before and after I add another gallery below

After I add a gallery the 'choose category' doesn't include the new gallery but does include the text I added for the image title

So I'm assuming there is a fault with the code there but I can't work out what!

Thanks for any help you can provide


5:27 am
December 23, 2009


tobi1kanoby

Member

posts 3

13

Hi Chanty.

I tried replacing line 243 as described and keep getting Parse error: syntax error, unexpected '<' in /home/content/t/o/b/tobisan/html/wp-content/plugins/nextgen-public-uploader/inc/npu-upload.php on line 243


when this is the script:

 $strOutput .= “\n</div>”;
include_once (NGGALLERY_ABSPATH.”lib/ngg-db.php”);
                $nggdb = new nggdb();
                   $gallerylist = $nggdb->find_all_galleries('gid', 'ASC');

any idea what Im doing wrong?

thanks

5:37 am
December 23, 2009


Valkrider

Member

posts 6

14

Post edited 10:40 am – December 23, 2009 by Valkrider


Laugh


Got it sorted. It is the same code Chanty said above but the line number is incorrect. It is line 280 that needs to have this code inserted. I also changed the quotes to proper ones in case that was the problem and also changed the word category to gallery. This is how my code now looks from line 280 onwards

[code]

include_once (NGGALLERY_ABSPATH.”lib/ngg-db.php”);
                $nggdb = new nggdb();
                   $gallerylist = $nggdb->find_all_galleries('gid', 'ASC');
              
                $strOutput .= "\n<div id=\”choosegallery\" style=\"margin: 10px 0 0 0;\">";
                $strOutput .= "\n<select id=\"npu_upload-id-$gal_id\" name=\"galleryselect\">
                               \n<option value=\"0\">Choose gallery</option>
                               \n<option value=\"\">&nbsp;</option>";
                   foreach ($gallerylist as $gallery) {
                $name = ( empty($gallery->title) ) ? $gallery->name : $gallery->title;
                $strOutput .= "\n<option value=\"$gallery->gid\">$name</option>"; }
                $strOutput .= "</select>";
                $strOutput .= "\n</div>";

[/code]


Thanks to everyone, particularly Chanty for this LaughLaughLaugh


If you want to see what it looks like on my site you can visit http://vrcc.turnspain.com

8:03 am
December 23, 2009


tobi1kanoby

Member

posts 3

15

Thanks Valkrider,

I visited you're site, very cool, I use the same template on mine- http://knows-dive.com

I managed to change the code as you said, ( did I need to delete anything from line 280?) and nothing has changed,

I couldnt see any loading options yet on your site. can you help me out here.


another question. 1.Do you know if theres a way to add users email adress or a name to attach to the image?

2. where can I specify the upload directory? where does the file go?

thanks again

8:15 am
December 23, 2009


tobi1kanoby

Member

posts 3

16

One more thing.

if it does work, can anyone show the script changed including a linr before and after the actual change, I keep getting error messages and Im very new at php

thanks

11:18 am
December 23, 2009


Valkrider

Member

posts 6

17

tobi1kanoby


You need to delete line 280 and in its place put the 13 lines of code above.

On my site the upload is minimised using the > symbol in the upload widget on the right hand side.

Looking at your site I think that you are going to have a problem using this widget as your left widget bar isn't wide enough. Consider increasing the width of your widget bar. Attached is a screenshot showing the space that you need taken from my site. Screen shot of uploader

The upload directory is part of the next gen configuration as it loads the photos into the gallery that the uploader selects.

There doesn't appear to be a way to capture the email address of the uploader, it is one of the things that has been requested.

If you have a problem editing the code and making it work, I have zipped it up and you can download it from http://turnspain.com/npu-upload.zip.


Hope this helps

Colin


Search 


If you can dream it, we can build it! Please contact us today to discuss your ideas and how WebDevStudios can help you today!