Title: Launch new image scan programatically
Last modified: July 3, 2019

---

# Launch new image scan programatically

 *  Resolved [superflyfr](https://wordpress.org/support/users/superflyfr/)
 * (@superflyfr)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/launch-new-image-scan-programatically/)
 * Hi,
    [echoing/describing the feature request made earlier] I have set a standard
   image gallery (WP MU) with a particular directory (/wp-content/uploads/sites/[
   blog_ID]/ngg-gallery).
 * What I need is that uploaded files within this directory are imported into the
   gallery at the end of the upload (that’s another part, dealing with gravity forms).
 * Basically, it’s exactly what we can trigger manually in the gallery settings 
   by clicking the button “scan for new images”.
 * I thought I could “retro-engineer” and add my own function to do that but I’d
   say that I’m ending with a few concerns about reliability and durability.
    Here’s
   where I am right now
 *     ```
       $gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE name = 'my-import-gallery' ");
       $gallery_id = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = 'my-import-gallery' ");
   
       // read list of images
       $new_imageslist = array_diff(scandir($gallerypath), array('..', '.','thumbs'));
       $old_imageslist = $wpdb->get_col("SELECT filename FROM $wpdb->nggpictures WHERE galleryid = $gallery_id ");
       $new_images = array_diff($new_imageslist, $old_imageslist);
       ```
   
 * So, I have the gallery_id, the image(s) to import array and I wish I could “simply”
   call a function like `nggAdmin::add_Images($galleryID, $new_images);`
    But I 
   believe it’s restricted for admin area only (or I’m missing something obvious
   for PHP experts …).
 * Note : as of now I’m using the free version but I’ll be glad to jump to the Pro
   version if this was achievable.
    BR, Antoine aka Superfly
    -  This topic was modified 6 years, 11 months ago by [superflyfr](https://wordpress.org/support/users/superflyfr/).
    -  This topic was modified 6 years, 11 months ago by [superflyfr](https://wordpress.org/support/users/superflyfr/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [superflyfr](https://wordpress.org/support/users/superflyfr/)
 * (@superflyfr)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/launch-new-image-scan-programatically/#post-11697483)
 * Note : I could inject images via SQL query but then I’ll miss the resize, thumbs
   and various features that make NGG so great 😉
 *  [Mihai Ceban](https://wordpress.org/support/users/mihaiimagely/)
 * (@mihaiimagely)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/launch-new-image-scan-programatically/#post-11698852)
 * Hi [@superflyfr](https://wordpress.org/support/users/superflyfr/),
 * Our efforts in the forum are more in offering support in breaking down what could
   be the source of the conflict (i.e. check server settings, check for possible
   plugin or theme conflict). If it’s something quick, like some CSS to add or remove
   a border, that’s OK.
 * Thanks for your understanding
    -  This reply was modified 6 years, 11 months ago by [Mihai Ceban](https://wordpress.org/support/users/mihaiimagely/).
 *  Thread Starter [superflyfr](https://wordpress.org/support/users/superflyfr/)
 * (@superflyfr)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/launch-new-image-scan-programatically/#post-11698886)
 * Hi Mihail,
    Fair enough, this was more FTR (and a feature vote suggestion)than
   a real support request.
 * Though, the final question “is it feasible” is pre-sale related and it’ll be 
   useful for me to get an answer.
    Thanks!
    -  This reply was modified 6 years, 11 months ago by [superflyfr](https://wordpress.org/support/users/superflyfr/).
    -  This reply was modified 6 years, 11 months ago by [superflyfr](https://wordpress.org/support/users/superflyfr/).
 *  [Mihai Ceban](https://wordpress.org/support/users/mihaiimagely/)
 * (@mihaiimagely)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/launch-new-image-scan-programatically/#post-11702310)
 * Hi [@superflyfr](https://wordpress.org/support/users/superflyfr/),
 * I will surely add it as a vote to our feature requests list which would be the
   most what we’ll be able to do even in case that you would have a Pro membership
   with us.
 * As long as I am aware, we don’t currently have such code workarounds that would
   help to achieve an automatically update for the images from all NextGen galleries
   and albums. The main thing to think about here is that a possible implementation
   will possible run into resource overflow problems for lots of installations due
   to the amount of processing data for sites with a high number of galleries.
 * Thanks for your understanding
    -  This reply was modified 6 years, 11 months ago by [Mihai Ceban](https://wordpress.org/support/users/mihaiimagely/).
    -  This reply was modified 6 years, 11 months ago by [Mihai Ceban](https://wordpress.org/support/users/mihaiimagely/).
    -  This reply was modified 6 years, 11 months ago by [Mihai Ceban](https://wordpress.org/support/users/mihaiimagely/).

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Launch new image scan programatically’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Mihai Ceban](https://wordpress.org/support/users/mihaiimagely/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/launch-new-image-scan-programatically/#post-11702310)
 * Status: resolved