Changeset 28256


Ignore:
Timestamp:
Apr 24, 2014, 11:31:29 AM (6 years ago)
Author:
plg
Message:

compatibility Piwigo 2.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Tags2File/db_export_image_metadata_class.php

    r4620 r28256  
    8888        $this->nbfiles = 0;
    8989
    90         while ($row = mysql_fetch_row($datas)) // row to avoid conflict with name
     90        while ($row = pwg_db_fetch_row($datas)) // row to avoid conflict with name
    9191        {               
    9292                $image_path = $row[5];
    93                 $has_high = $row[6] === 'true';
    9493               
    9594                if ($this->isTest || file_exists($image_path))
     
    9897                        {
    9998                                $cmd = $this->convert_row_to_file_exiftool($row);
    100                                 $this->write_exifCmd($cmd, $image_path, $has_high, $fp_exiftool);
     99                                $this->write_exifCmd($cmd, $image_path, $fp_exiftool);
    101100                        }
    102101                        if ($this->use_exiv2)
    103102                        {
    104103                                $cmd = $this->convert_row_to_file_exiv2($row);
    105                                 $this->write_exifCmd($cmd, $image_path, $has_high, $fp_exiv2);
     104                                $this->write_exifCmd($cmd, $image_path, $fp_exiv2);
    106105                        }
    107106                }
     
    169168        $tags = $this->cutString($this->decode_html_string_to_unicode($row[4], true), 64);
    170169        $image_path = $row[5];
    171         $has_high = $row[6] === 'true';
    172170       
    173171        $exiv2Cmd = $this->exiv2DefaultCmd;
     
    228226  }
    229227
    230   private function write_exifCmd($exifCmd, $image_path, $has_high, $fp)
     228  private function write_exifCmd($exifCmd, $image_path, $fp)
    231229  {
    232230        $exifCmdN = $exifCmd ." ";
     
    235233        if ($writeOK)  $this->nbfiles++;
    236234
    237         if ($has_high)
    238         {
    239                 $imageHigh = dirname($image_path) . "/pwg_high/" . basename($image_path);
    240                 if (file_exists($imageHigh))
    241                 {       $this->write_exifCmd($exifCmd, $imageHigh, false, $fp);  }
    242         }
    243235  }
    244236
     
    312304        $query_path = $this->isTest ? 'img.file' : 'img.path';
    313305        $query_restriction = $this->isTest ? 'AND (img.id = '.$this->test_img_id.'))' : ')';
     306 
    314307        // get direct properties and tags, even if no tags, with either name, comment or tags not null
    315308        // restritive query with image.ID for tests with copied images with file instead of path
    316         $img_query = 'SELECT img.name, img.comment, img.author, img.date_creation, GROUP_CONCAT(tags.name), '.$query_path.', has_high
    317                 FROM '.IMAGES_TABLE.' AS img
    318                 LEFT OUTER JOIN '.IMAGE_TAG_TABLE.' AS img_tag ON img_tag.image_id = img.id
    319                 LEFT OUTER JOIN '.TAGS_TABLE.' AS tags ON tags.id = img_tag.tag_id
    320                 WHERE ( ( LENGTH(img.name) > 0 OR LENGTH(img.comment) > 0 OR LENGTH(img.author) > 0 OR LENGTH(tags.name) > 0 ) '.$query_restriction.'
    321                 GROUP BY img.id, img.name, img.comment, img.author, '.$query_path.', has_high
    322                 ORDER BY img.id ASC; ';
     309        $img_query = '
     310SELECT
     311    img.name,
     312    img.comment,
     313    img.author,
     314    img.date_creation,
     315    GROUP_CONCAT(tags.name),
     316    '.$query_path.'
     317  FROM '.IMAGES_TABLE.' AS img
     318    LEFT OUTER JOIN '.IMAGE_TAG_TABLE.' AS img_tag ON img_tag.image_id = img.id
     319    LEFT OUTER JOIN '.TAGS_TABLE.' AS tags ON tags.id = img_tag.tag_id
     320  WHERE ( ( LENGTH(img.name) > 0 OR LENGTH(img.comment) > 0 OR LENGTH(img.author) > 0 OR LENGTH(tags.name) > 0 ) '.$query_restriction.'
     321  GROUP BY img.id, img.name, img.comment, img.author, '.$query_path.'
     322  ORDER BY img.id ASC
     323;';
    323324       
    324325        return pwg_query($img_query);
Note: See TracChangeset for help on using the changeset viewer.