NextGEN Gallery
[resolved] Nextgen: Imagedate mising on copied images after using "copy to...&qu (2 posts)

  1. bravelemming
    Posted 3 years ago #

    In Nextgen, when you copy images from gallery A to gallery B, each copied image date is set to "30 November -0001" (even if the EXIF data is copied correctly).
    This is a problem to sort images by date in gallery B.
    I've sorted it very quickly by adding imagedate in the insert_image function:

         * Insert an image in the database
         * @return the ID of the inserted image
        function insert_image($gid, $filename, $alttext, $desc, $exclude, $imagedate = NULL) {
            global $wpdb;
            if (isset($imagedate)) {
              $result = $wpdb->query(
                  "INSERT INTO $wpdb->nggpictures (galleryid, filename, description, alttext, exclude, imagedate) VALUES "
                . "('$gid', '$filename', '$desc', '$alttext', '$exclude', '$imagedate');");
              $pid = (int) $wpdb->insert_id;
              wp_cache_delete($gid, 'ngg_gallery');
            } else {
              $result = $wpdb->query(
                  "INSERT INTO $wpdb->nggpictures (galleryid, filename, description, alttext, exclude) VALUES "
                . "('$gid', '$filename', '$desc', '$alttext', '$exclude');");
              $pid = (int) $wpdb->insert_id;
              wp_cache_delete($gid, 'ngg_gallery');
            return $pid;

    and update the function call in the function copy_images of functions.php

    // Create new database entry for the image
    			$new_pid = nggdb::insert_image( $destination->gid, $destination_file_name, $image->alttext, $image->description, $image->exclude<strong>, $image->imagedate</strong>);

    This works for me but I don't think it's optimal. I just wanted the developers to know about it...



  2. .gabriel.
    Posted 3 years ago #

    Same issue in the latest release of Nextgen, 1.9.12. Thanks for posting your workaround.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • NextGEN Gallery
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic