public function buildPath($filename, Polycast_Filter_ImageSize_Configuration_Interface $config)
 {
     $chunks = explode('.', strrev(basename($filename)), 2);
     $basename = strrev(array_pop($chunks));
     $ext = strrev(array_pop($chunks));
     switch ($config->getOutputImageType()) {
         case 'jpeg':
             $ext = '.jpg';
             break;
         case 'gif':
             $ext = '.gif';
             break;
         case 'png':
             $ext = '.png';
             break;
         case 'auto':
         case null:
         default:
             $ext = ".{$ext}";
     }
     if ($config instanceof ExamplesTest_NamedConfig) {
         $postfix = $config->getTemplateName();
     } else {
         $postfix = sprintf('%sx%s-q%s', $config->getWidth(), $config->getHeight(), $config->getQuality());
     }
     $path = sprintf('%s/%s-%s%s', $this->_outputDir, $basename, $postfix, $ext);
     return $path;
 }
Ejemplo n.º 2
0
 protected function _getBasename()
 {
     $chunks = explode('.', strrev(basename($this->_inputFilename)), 2);
     $basename = strrev(array_pop($chunks));
     $ext = strrev(array_pop($chunks));
     switch ($this->_config->getOutputImageType()) {
         case 'jpeg':
             $ext = '.jpg';
             break;
         case 'gif':
             $ext = '.gif';
             break;
         case 'png':
             $ext = '.png';
             break;
         case 'auto':
         case null:
         default:
             $ext = ".{$ext}";
     }
     return sprintf('%s-%sx%s%s', $basename, $this->_config->getWidth(), $this->_config->getHeight(), $ext);
 }