This commit is contained in:
Kekskurse 2021-01-13 18:16:57 +01:00
parent dbcaef9c65
commit 416565f228
3 changed files with 12 additions and 41 deletions

View file

@ -39,6 +39,8 @@ class PublicController extends BaseController
}
public function returnImageFile($tenant, $gallery, $image, Request $request) {
$globalstart = microtime(true);
Log::info("Getting Image start", ["time" => microtime(true)]);
$tenant = Tenant::query()->where("url", "=", $tenant)->firstOrFail();
$gallery = Gallery::getByTenantAndUrl($tenant->id, $gallery);
$image = Image::query()->where("gallery", "=", $gallery->id)->where("id", "=", $image)->firstOrFail();
@ -76,9 +78,13 @@ class PublicController extends BaseController
return Storage::disk('cache')->response($cacheName."_small");
}
if($size == "medium") {
$start = microtime(true);
$image = ImageResize::createFromString($file);
$image->resizeToLongSide(self::SIZE_MEDIUM);
Storage::disk("cache")->put($cacheName."_medium", $image->getImageAsString());
$ende = microtime(true);
Log::info("Dauer umwandlung: ".($ende-$start));
Log::info("Gesamtzeit: ".(microtime(true)-$globalstart));
return Storage::disk('cache')->response($cacheName."_medium");
}

View file

@ -10,7 +10,7 @@ apt-get install -y nginx
# PHP (Ubuntu 20.04)
```
apt install -y php-fpm php php-simplexml php-mbstring php-gd php-mysql
apt install -y php-fpm php-cli php-simplexml php-mbstring php-gd php-mysql unzip php-zip
```
# Install Composer
@ -35,6 +35,11 @@ GRANT ALL ON kuvia.* TO 'kuvia'@'localhost';
FLUSH PRIVILEGES;
```
```
CREATE USER 'kuvia'@'%' IDENTIFIED WITH mysql_native_password BY 'QA8jS9T.H;8RB<A4';
GRANT ALL ON kuvia.* TO 'kuvia'@'%';
```
# Setup Project

View file

@ -1,40 +0,0 @@
@extends('layout/template')
@section('content')
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<h1>Galleries {{ $gallery->name }}</h1>
<div id="mygallery" >
<div id="fotorama" class="fotorama" data-allowfullscreen="true" data-nav="thumbs" data-width="100%">
@foreach($images as $image)
<img src="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=medium" data-full="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=big" >
@endforeach
</div>
</div>
</div>
</div>
@endsection
@section('js')
<link href="https://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.4/fotorama.js"></script>
<script>
$(function () {
// 1. Initialize fotorama manually.
var $fotoramaDiv = $('#fotorama').fotorama();
// 2. Get the API object.
var fotorama = $fotoramaDiv.data('fotorama');
// 3. Inspect it in console.
console.log(fotorama);
fotorama.requestFullScreen()
});
</script>
@endsection