PHP Класс BookStack\Services\ImageService

Наследование: extends UploadService
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$cache
$imageTool
$storageUrl

Открытые методы

Метод Описание
__construct ( Intervention\Image\ImageManager $imageTool, Illuminate\Contracts\Filesystem\Factory $fileSystem, Illuminate\Contracts\Cache\Repository $cache ) ImageService constructor.
destroyImage ( Image $image ) : boolean Destroys an Image object along with its files and thumbnails.
getThumbnail ( Image $image, integer $width = 220, integer $height = 220, boolean $keepRatio = false ) : string Get the thumbnail for an image.
saveNewFromUpload ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile, string $type, integer $uploadedTo ) : mixed Saves a new image from an upload.
saveUserGravatar ( User $user, integer $size = 500 ) : mixed Save a gravatar image and set a the profile image for a user.

Защищенные методы

Метод Описание
getPath ( Image $image ) : mixed | string Get the storage path, Dependant of storage type.

Приватные методы

Метод Описание
getPublicUrl ( string $filePath ) : string Gets a public facing url for an image by checking relevant environment variables.
saveNew ( string $imageName, string $imageData, string $type, integer $uploadedTo ) : Image Saves a new image
saveNewFromUrl ( $url, string $type, boolean | string $imageName = false ) : mixed Gets an image from url and saves it to the database.

Описание методов

__construct() публичный Метод

ImageService constructor.
public __construct ( Intervention\Image\ImageManager $imageTool, Illuminate\Contracts\Filesystem\Factory $fileSystem, Illuminate\Contracts\Cache\Repository $cache )
$imageTool Intervention\Image\ImageManager
$fileSystem Illuminate\Contracts\Filesystem\Factory
$cache Illuminate\Contracts\Cache\Repository

destroyImage() публичный Метод

Destroys an Image object along with its files and thumbnails.
public destroyImage ( Image $image ) : boolean
$image BookStack\Image
Результат boolean

getPath() защищенный Метод

Get the storage path, Dependant of storage type.
protected getPath ( Image $image ) : mixed | string
$image BookStack\Image
Результат mixed | string

getThumbnail() публичный Метод

If $keepRatio is true only the width will be used. Checks the cache then storage to avoid creating / accessing the filesystem on every check.
public getThumbnail ( Image $image, integer $width = 220, integer $height = 220, boolean $keepRatio = false ) : string
$image BookStack\Image
$width integer
$height integer
$keepRatio boolean
Результат string

saveNewFromUpload() публичный Метод

Saves a new image from an upload.
public saveNewFromUpload ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadedFile, string $type, integer $uploadedTo ) : mixed
$uploadedFile Symfony\Component\HttpFoundation\File\UploadedFile
$type string
$uploadedTo integer
Результат mixed

saveUserGravatar() публичный Метод

Save a gravatar image and set a the profile image for a user.
public saveUserGravatar ( User $user, integer $size = 500 ) : mixed
$user BookStack\User
$size integer
Результат mixed

Описание свойств

$cache защищенное свойство

protected $cache

$imageTool защищенное свойство

protected $imageTool

$storageUrl защищенное свойство

protected $storageUrl