This commit is contained in:
Kekskurse 2021-01-17 02:10:33 +01:00
parent 6b8d603237
commit 774eadbeca
2 changed files with 11 additions and 1 deletions

View file

@ -23,6 +23,7 @@ class PublicController extends BaseController
const SIZE_SMALL = 300;
const SIZE_MEDIUM = 600;
const SIZE_BIG = 1200;
const SIZE_PIXEL = 100;
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function listGalleriesView($name) {
@ -107,6 +108,15 @@ class PublicController extends BaseController
return Storage::disk('cache')->response($cacheName."_big");
}
if($size == "pixel") {
$start = microtime(true);
$image = ImageResize::createFromString($file);
$image->resizeToLongSide(self::SIZE_BIG);
Storage::disk("cache")->put($cacheName."_pixel", $image->getImageAsString());
$ende = microtime(true);
Log::info("Dauer umwandlung pixel: ".($ende-$start). "/" . "Gesamtzeit: ".(microtime(true)-$globalstart));
return Storage::disk('cache')->response($cacheName."_pixel");
}
return abort(500);
}

View file

@ -10,7 +10,7 @@
<!-- Add photos -->
@foreach($images as $image)
<img class="imageToReplace" src="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=big" data-src="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=big" data-thumb="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=small">
<img class="imageToReplace" src="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=big" data-thumb="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=pixel">
@endforeach
</div>