PHP Class BookStack\Services\ImageService

Inheritance: extends UploadService
Afficher le fichier Open project: ssddanbrown/bookstack

Protected Properties

Свойство Type Description
$cache
$imageTool
$storageUrl

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
getPath ( Image $image ) : mixed | string Get the storage path, Dependant of storage type.

Private Methods

Méthode Description
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.

Method Details

__construct() public méthode

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() public méthode

Destroys an Image object along with its files and thumbnails.
public destroyImage ( Image $image ) : boolean
$image BookStack\Image
Résultat boolean

getPath() protected méthode

Get the storage path, Dependant of storage type.
protected getPath ( Image $image ) : mixed | string
$image BookStack\Image
Résultat mixed | string

getThumbnail() public méthode

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
Résultat string

saveNewFromUpload() public méthode

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
Résultat mixed

saveUserGravatar() public méthode

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
Résultat mixed

Property Details

$cache protected_oe property

protected $cache

$imageTool protected_oe property

protected $imageTool

$storageUrl protected_oe property

protected $storageUrl