Support » Plugin: NextGEN Gallery - WordPress Gallery Plugin » [Plugin: NextGEN Gallery] Nextgen: Imagedate mising on copied images after using "copy to…&qu

  • Resolved bravelemming

    (@bravelemming)


    Hi,
    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…

    Regards,
    JP

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

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: NextGEN Gallery] Nextgen: Imagedate mising on copied images after using "copy to…&qu’ is closed to new replies.