Ejemplo n.º 1
0
 /**
  * Create thumbnails from uploaded image
  *
  * @return void
  */
 private function _create_thumbs()
 {
     // Thumbnails
     foreach ($this->_thumbnails as $thumbnail) {
         // Create dir for thumbnail
         $this->_fs->mkdir($this->_config['dir'] . $thumbnail['dir']);
         // Previous saved image
         $thumb = new PHPThumb\GD($this->_config['dir'] . $this->_newfilename);
         // Set jpeg quality for thumbnail
         $thumb->setOptions(array('jpegQuality' => $thumbnail['jpeg_quality']));
         // If fixed size
         if ($thumbnail['adaptive']) {
             $thumb->adaptiveResize($thumbnail['max_width'], $thumbnail['max_height']);
         } else {
             $thumb->resize($thumbnail['max_width'], $thumbnail['max_height']);
         }
         // Save the image file to directory
         $thumb->save($this->_config['dir'] . $thumbnail['dir'] . DS . $this->_newfilename);
     }
 }