コード例 #1
0
ファイル: attachment.php プロジェクト: weareathlon/silla.io
 /**
  * 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());
         }
     }
 }
コード例 #2
0
ファイル: imageTest.php プロジェクト: weareathlon/silla.io
 /**
  * @covers Core\Helpers\Image::getSize
  */
 public function testGettingSize()
 {
     $this->assertInternalType('array', Image::getSize($this->imagePath));
 }