* fixed image download
This commit is contained in:
parent
40ac17d892
commit
05519c20ba
@ -29,4 +29,4 @@
|
||||
$app->get('/', App\Action\HomePageAction::class, 'home');
|
||||
$app->get('/api/galleries', App\Action\ListGalleriesAction::class, 'api.galleries');
|
||||
$app->get('/api/gallery/{slug}', App\Action\GetGalleryImagesAction::class, 'api.gallery');
|
||||
$app->get('/api/image/{slug}/{image}[/thumb]', App\Action\GetImageAction::class, 'api.image');
|
||||
$app->get('/api/image/{slug}/{image}[/{thumb}]', App\Action\GetImageAction::class, 'api.image');
|
||||
|
||||
@ -61,18 +61,18 @@ class GalleryService
|
||||
];
|
||||
}
|
||||
|
||||
public function getImage(string $slug, string $image, bool $size)
|
||||
public function getImage(string $slug, string $image, $size = false): string
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
$galleryDir = sprintf(self::IMAGE_BASEDIR, $config['galleries'][$slug]['dir']);
|
||||
$imageFileName = $size
|
||||
? $galleryDir . $image
|
||||
: $this->getResizedImageName($galleryDir, $image, $size);
|
||||
? $this->getResizedImageName($galleryDir, $image, $size)
|
||||
: ( $galleryDir . $image );
|
||||
|
||||
return $imageFileName;
|
||||
}
|
||||
|
||||
protected function getResizedImageName($galleryDirectory, $imageName, $size)
|
||||
protected function getResizedImageName($galleryDirectory, $imageName, $size): string
|
||||
{
|
||||
$numericSize = $size == 'thumb' ? self::THUMBNAIL_SIZE : $size;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user