• Resolved Webmaster BG3

    (@webmaster-bg3)


    I am going to implement a routine to batch-import a lot of galleries from a CSV file in a format like this:

    /path-of-folder/;Title of The Gallery;#AlbumID (numeric)

    First: it recall nggAdmin::import_gallery()
    Second: it set gallery title with a simple SQL query
    Third: it add gallery (suppose we have the $gallery_id) to specified album ($gallery_id)

    It was difficult to me to write this third point because of my low knowledge of ngg_album/sortorder field.

    Can anyone help me with this function?

    function add_to_album( $galleryID , $albumID )
    {
    ????
    }

    http://wordpress.org/extend/plugins/nextgen-gallery/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Webmaster BG3

    (@webmaster-bg3)

    solved by myself

    How did you do that, I’m really interested how to do this.

    Thanks!

    Plugin Contributor photocrati

    (@photocrati)

    @webmaster BG3 – Yes, please share the final code you wrote! Just drop it into a pastebin or gist and share the link here.

    We love to see people stretching things out with NextGEN Gallery!

    Thread Starter Webmaster BG3

    (@webmaster-bg3)

    Nextgen version 1.9.x
    All files in wp-content/plugins/nextgen-gallery/admin

    batch-import.php (user interface)
    http://pastebin.com/AsqVTbHr

    processor.php (do all the job)
    http://pastebin.com/gUZDZS4L

    csv.php (not a real csv class but only a line by line reader)
    http://pastebin.com/HjdhAzAR

    csv format is
    PATH;TITLE;ALBUM

    i.e.
    /testme;A test gallery;3

    import the folder /testme (processor.php contain basepath) in a new gallery, assign the title “A test gallery” and add the gallery to albumID #3

    of course you have to prepare a CSV, and a directory tree with your gallery and picture file (name must be sanitized, no space, no strange character)

    hope to be helpful

    my nextgen: 33 album, 513 gallery, 47786 images… growing everyday!

    Plugin Contributor photocrati

    (@photocrati)

    @webmaster BG3 – Thank you very much for sharing this!

    – Cais.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘programmatically add gallery to album’ is closed to new replies.