Changeset 23321


Ignore:
Timestamp:
Jun 18, 2013, 1:08:10 PM (8 years ago)
Author:
mistic100
Message:

improve filenames, fix for calendar view

Location:
extensions/BatchDownloader/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/BatchDownloader/include/BatchDownloader.class.php

    r23318 r23321  
    448448      {
    449449        $query = '
    450 SELECT image_id, filesize
     450SELECT image_id, filesize, width, height
    451451  FROM '.IMAGE_SIZES_TABLE.'
    452452  WHERE image_id IN ('.implode(',', array_keys($images_to_add)).')
    453453    AND type = "'.$this->data['size'].'"
    454454;';
    455         $filesizes = simple_hash_from_query($query, 'image_id', 'filesize');
     455        $filesizes = hash_from_query($query, 'image_id');
    456456      }
    457457     
     
    472472        }
    473473       
     474        $filename =  $row['id'].'_'.stripslashes(get_filename_wo_extension($row['file']));
     475       
    474476        if ($this->data['size'] == 'original')
    475477        {
    476           $zip->addFile(PHPWG_ROOT_PATH.$row['path'], $row['id'].'_'.stripslashes(get_filename_wo_extension($row['file'])).'.'.get_extension($row['path']));
     478          $filename.= '_'.$row['width'].'x'.$row['height'];
     479          $zip->addFile(PHPWG_ROOT_PATH.$row['path'], $filename.'.'.get_extension($row['path']));
    477480          $total_size+= $row['filesize'];
    478481        }
     
    484487          if ($src_image->is_mimetype())
    485488          {
    486             $zip->addFile(PHPWG_ROOT_PATH.$row['path'], $row['id'].'_'.stripslashes(get_filename_wo_extension($row['file'])).'.'.get_extension($row['path']));
     489            $zip->addFile(PHPWG_ROOT_PATH.$row['path'], $filename.'.'.get_extension($row['path']));
    487490            $total_size+= $row['filesize'];
    488491          }
     
    492495            $derivative = new DerivativeImage($this->data['size'], $src_image);
    493496            $path = $derivative->get_path();
    494        
    495             $zip->addFile($path, $row['id'].'_'.stripslashes(get_filename_wo_extension(basename($path))).'.'.get_extension($path));
    496             $total_size+= $filesizes[ $row['id'] ];
     497           
     498            $filename.= '_'.$filesizes[ $row['id'] ]['width'].'x'.$filesizes[ $row['id'] ]['height'];
     499            $zip->addFile($path, $filename.'.'.get_extension($path));
     500            $total_size+= $filesizes[ $row['id'] ]['filesize'];
    497501          }
    498502        }
     
    652656    $set = $this->getNames();
    653657   
    654     include_once(PHPWG_ROOT_PATH . 'admin/include/functions.php');
    655    
    656658    $path = BATCH_DOWNLOAD_LOCAL . 'u-'. $this->data['user_id'] . '/';
    657659    $path.= !empty($this->conf['archive_prefix']) ? $this->conf['archive_prefix'] . '_' : null;
    658     $path.= get_username($this->data['user_id']) . '_';
    659     $path.= $set['BASENAME'] . '_';
     660    $path.= $set['BASENAME'] . '_' . $this->data['size'] . '_';
    660661    $path.= $this->data['user_id'] . $this->data['id'];
    661662    $path.= '_part' . $i . '.zip';
  • extensions/BatchDownloader/include/events.inc.php

    r23318 r23321  
    6666  {
    6767  case 'categories':
    68     if (!isset($page['category'])) return; // don't download the full gallery in flat mode !
     68    if (!isset($page['category']) && !isset($page['chronology_field'])) return; // don't download the full gallery in flat mode !
    6969   
    7070    if (!in_array('categories', $conf['batch_download']['what'])) return;
  • extensions/BatchDownloader/include/functions.inc.php

    r23318 r23321  
    3333      else if (isset($page['flat'])) // this is for the whole gallery only, flat mode for category is above
    3434      {
    35         $batch_type = 'flat';
    36         $batch_id = null;
     35        return false;
    3736      }
    3837      break;
Note: See TracChangeset for help on using the changeset viewer.