When adding new images and/or archives to a gallery then all previous caption-fields get deleted from the database.

I'm betting users will become seriously pissed off after having uploaded an entire archive, given each and every image a descriptive caption, and then having them all deleted after adding just a single image to the album.

Comments

silviogutierrez’s picture

Sounds pretty serious, I'll take a look immediately.

Silvio

silviogutierrez’s picture

Fixed it, replace _gallerix_extract_data(&$node) in gallerix_management.inc with this code:

<?php
/**
 * Extract all possible data from an album, according to the given settings.
 *
 */
function _gallerix_extract_data(&$node) {
  $pictures = db_query("SELECT pid, caption, path FROM {gallerix_pictures} WHERE nid = %d", $node->nid);
  
  $exif_extract = variable_get('gallerix_extract_exif', 0);
  $iptc_extract = variable_get('gallerix_extract_iptc', 0);
  
  
  
    
  while($picture = db_fetch_object($pictures)) {
    $exif = $exif_extract ? exif_read_data($picture->path) : '';

    
    //If exif exists, extract the caption into a separate caption field.
    $caption = $exif ? ($exif['Title'] ? $exif['Title'] : $exif['ImageDescription']) : '';
    $caption = trim($caption);
    
    //If there was already a caption, do not replace it.
    $caption = $picture->caption ? $picture->caption : $caption; 
           
    //Then use the DateTimeOriginal field as the created date.
    $created = $exif ? _gallerix_format_date_exif($exif['DateTimeOriginal']) : 0;
    //ImageDescription is also fairly standard.
       
    //Now extract all selected fields, and serialize the data.     
    $exif = $exif ? _gallerix_extract_exif_fields($exif, variable_get('gallerix_fields_to_extract', array('Title', 'ImageDescription', 'DateTimeOriginal'))) : '';
    
    //Extract IPTC tags.    
    $tags = $iptc_extract ? extract_iptc_data($picture->path) : '';
    
    db_query("UPDATE {gallerix_pictures} SET created = %d, caption = '%s', exif = '%s', iptc = '%s' WHERE pid = '%s'", $created, $caption, $exif, $tags, $picture->pid);   
  }   
}
?>

Naturally this fix will be implemented into the next release.

Thanks for bringing it up,

Silvio

psletten’s picture

Than you very much for fixing this issue so quickly.

/Peter

silviogutierrez’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.