Beispiel #1
0
 /**
  * Create all related file thumbnails.
  *
  * @param Base\Model $resource            Currently processed resource.
  * @param string     $name                Name of the thumbnail.
  * @param string     $attachment_filename Attachment file name.
  * @param array      $thumbnails          Array of thumbnail sizes.
  *
  * @access private
  * @static
  *
  * @return void
  */
 private static function createThumbnails(Base\Model $resource, $name, $attachment_filename, array $thumbnails)
 {
     foreach ($thumbnails as $thumbnail) {
         try {
             switch ($thumbnail['type']) {
                 case 'resize':
                     Helpers\Image::createScaledThumbnail($resource->attachmentsStoragePath($name) . $attachment_filename, array($thumbnail['size']));
                     break;
                 case 'crop':
                     Helpers\Image::createCroppedThumbnail($resource->attachmentsStoragePath($name) . $attachment_filename, array($thumbnail['size']));
                     break;
             }
         } catch (\Exception $e) {
             var_log($e->getMessage());
         }
     }
 }
Beispiel #2
0
 /**
  * @covers Core\Helpers\Image::getSize
  */
 public function testGettingSize()
 {
     $this->assertInternalType('array', Image::getSize($this->imagePath));
 }