This commit is contained in:
Kekskurse 2021-01-12 17:50:08 +01:00
parent 6d5d8c666f
commit fc0df020e8
250 changed files with 142 additions and 2 deletions

View file

@ -125,4 +125,11 @@ class GalleryController extends BaseController
return $name; return $name;
} }
public function showImagesView($name) {
$gallery = Gallery::getByTenantAndUrl(session("current_tenant_id"), $name);
$tenant = Tenant::query()->where("id", "=", $gallery->tenant)->firstOrFail();
$images = Image::query()->where("gallery", "=", $gallery->id)->get();
return view("gallery.images", ["images" => $images, "gallery" => $gallery, "tenant" => $tenant]);
}
} }

View file

@ -20,7 +20,7 @@ class Gallery extends Migration
$table->string('url'); $table->string('url');
$table->mediumText("description")->nullable(); $table->mediumText("description")->nullable();
$table->unsignedBigInteger("tenant"); $table->unsignedBigInteger("tenant");
$table->date("gallery_create_time")->default(\Illuminate\Support\Facades\DB::raw('CURRENT_DATE')); $table->date("gallery_create_time")->default(\Illuminate\Support\Facades\DB::raw('(CURRENT_DATE)'));
$table->foreign('tenant')->references('id')->on('tenants'); $table->foreign('tenant')->references('id')->on('tenants');

83
docs/setup-server.md Normal file
View file

@ -0,0 +1,83 @@
# Basic Tools
```
apt-get install -y git
```
# NGINX
```
apt-get install -y nginx
```
# PHP (Ubuntu 20.04)
```
apt install -y php-fpm php php-simplexml php-mbstring php-gd php-mysql
```
# Install Composer
```
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=/bin --filename=composer
php -r "unlink('composer-setup.php');"
```
# Setup MYSQL
```
apt-get install -y mysql-server
mysql_secure_installation
mysql_secure_installation
```
Run the following mysql commands
```
CREATE DATABASE kuvia;
CREATE USER 'kuvia'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON kuvia.* TO 'kuvia'@'localhost';
FLUSH PRIVILEGES;
```
# Setup Project
```
cd /var/www
git clone https://git.keks.cloud/kekskurse/kuvia.git
cd kuvia
composer install
```
# Setup .env
Setup env
# Setup nginx config
/etc/nginx/sites-available/kuvia
```
server {
listen 80;
server_name kuvia.cloud www.kuvia.cloud;
root /var/www/kuvia/public;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
```
run
```
ln -s /etc/nginx/sites-available/kuvia /etc/nginx/sites-enabled/
systemctl restart nginx
```

View file

@ -0,0 +1,45 @@
@extends('layout/template')
@section('content')
<div class="row">
<div class="col-md-12">
@foreach($images as $image)
<div class="card col-md-2" style="float:left;cursor: pointer;" data-toggle="modal" data-target="#exampleModal">
<div class="card-body" style="text-align: center;">
<img class="card-img-top" src="/{{ $tenant->url }}/{{ $gallery->url }}/{{ $image->id }}/file?size=small" style="height: 200px;width: auto; max-width: 100%;">
<h5 class="card-title">
{{ $image->filename }}
</h5>
</div>
</div>
@endforeach
</div>
</div>
<!-- Button trigger modal -->
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
@endsection

View file

@ -33,7 +33,7 @@
</button> </button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="/g/{{$gallery->url}}/upload">Upload Images</a> <a class="dropdown-item" href="/g/{{$gallery->url}}/upload">Upload Images</a>
<a class="dropdown-item" href="#">Bilder</a> <a class="dropdown-item" href="/g/{{$gallery->url}}">Bilder</a>
<a class="dropdown-item" href="#">Delete</a> <a class="dropdown-item" href="#">Delete</a>
</div> </div>
</div> </div>
@ -42,4 +42,8 @@
@endforeach @endforeach
</table> </table>
</div> </div>
@endsection @endsection

View file

@ -39,6 +39,7 @@ Route::middleware([\App\Http\Middleware\TenanMiddleware::class])->group(function
Route::post("/g/new", [\App\Http\Controllers\GalleryController::class, 'newGallery']); Route::post("/g/new", [\App\Http\Controllers\GalleryController::class, 'newGallery']);
Route::get("/g/{url}/upload", [\App\Http\Controllers\GalleryController::class, 'imagesUploadView']); Route::get("/g/{url}/upload", [\App\Http\Controllers\GalleryController::class, 'imagesUploadView']);
Route::post("/g/{url}/upload", [\App\Http\Controllers\GalleryController::class, 'imageUpload']); Route::post("/g/{url}/upload", [\App\Http\Controllers\GalleryController::class, 'imageUpload']);
Route::get("/g/{url}", [\App\Http\Controllers\GalleryController::class, 'showImagesView']);
}); });
Route::get("/{name}", [\App\Http\Controllers\PublicController::class, 'listGalleriesView'])->middleware([\App\Http\Middleware\TenanMiddleware::class]); Route::get("/{name}", [\App\Http\Controllers\PublicController::class, 'listGalleriesView'])->middleware([\App\Http\Middleware\TenanMiddleware::class]);

BIN
storage/cache/cache_1_3_100_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

BIN
storage/cache/cache_1_3_100_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
storage/cache/cache_1_3_100_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

BIN
storage/cache/cache_1_3_100_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
storage/cache/cache_1_3_101_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

BIN
storage/cache/cache_1_3_101_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
storage/cache/cache_1_3_101_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 KiB

BIN
storage/cache/cache_1_3_101_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
storage/cache/cache_1_3_102_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

BIN
storage/cache/cache_1_3_102_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
storage/cache/cache_1_3_102_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 KiB

BIN
storage/cache/cache_1_3_102_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
storage/cache/cache_1_3_103_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

BIN
storage/cache/cache_1_3_103_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
storage/cache/cache_1_3_103_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 KiB

BIN
storage/cache/cache_1_3_103_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
storage/cache/cache_1_3_104_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

BIN
storage/cache/cache_1_3_104_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
storage/cache/cache_1_3_104_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 KiB

BIN
storage/cache/cache_1_3_104_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
storage/cache/cache_1_3_105_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 KiB

BIN
storage/cache/cache_1_3_105_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
storage/cache/cache_1_3_105_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 KiB

BIN
storage/cache/cache_1_3_105_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
storage/cache/cache_1_3_106_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

BIN
storage/cache/cache_1_3_106_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
storage/cache/cache_1_3_106_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

BIN
storage/cache/cache_1_3_106_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
storage/cache/cache_1_3_107_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

BIN
storage/cache/cache_1_3_107_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
storage/cache/cache_1_3_107_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 KiB

BIN
storage/cache/cache_1_3_107_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
storage/cache/cache_1_3_108_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

BIN
storage/cache/cache_1_3_108_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
storage/cache/cache_1_3_108_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

BIN
storage/cache/cache_1_3_108_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
storage/cache/cache_1_3_109_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

BIN
storage/cache/cache_1_3_109_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
storage/cache/cache_1_3_109_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

BIN
storage/cache/cache_1_3_109_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
storage/cache/cache_1_3_110_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

BIN
storage/cache/cache_1_3_110_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
storage/cache/cache_1_3_110_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 KiB

BIN
storage/cache/cache_1_3_110_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
storage/cache/cache_1_3_111_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

BIN
storage/cache/cache_1_3_111_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
storage/cache/cache_1_3_111_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 KiB

BIN
storage/cache/cache_1_3_111_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
storage/cache/cache_1_3_112_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

BIN
storage/cache/cache_1_3_112_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
storage/cache/cache_1_3_112_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

BIN
storage/cache/cache_1_3_112_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

BIN
storage/cache/cache_1_3_113_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
storage/cache/cache_1_3_113_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
storage/cache/cache_1_3_113_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

BIN
storage/cache/cache_1_3_113_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
storage/cache/cache_1_3_114_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

BIN
storage/cache/cache_1_3_114_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
storage/cache/cache_1_3_114_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 KiB

BIN
storage/cache/cache_1_3_114_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
storage/cache/cache_1_3_115_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

BIN
storage/cache/cache_1_3_115_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
storage/cache/cache_1_3_115_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 KiB

BIN
storage/cache/cache_1_3_115_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
storage/cache/cache_1_3_116_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

BIN
storage/cache/cache_1_3_116_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
storage/cache/cache_1_3_116_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

BIN
storage/cache/cache_1_3_116_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
storage/cache/cache_1_3_117_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

BIN
storage/cache/cache_1_3_117_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
storage/cache/cache_1_3_117_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 KiB

BIN
storage/cache/cache_1_3_117_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
storage/cache/cache_1_3_118_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

BIN
storage/cache/cache_1_3_118_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

BIN
storage/cache/cache_1_3_118_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 556 KiB

BIN
storage/cache/cache_1_3_118_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
storage/cache/cache_1_3_119_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

BIN
storage/cache/cache_1_3_119_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
storage/cache/cache_1_3_119_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

BIN
storage/cache/cache_1_3_119_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
storage/cache/cache_1_3_120_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

BIN
storage/cache/cache_1_3_120_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
storage/cache/cache_1_3_120_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

BIN
storage/cache/cache_1_3_120_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
storage/cache/cache_1_3_121_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

BIN
storage/cache/cache_1_3_121_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
storage/cache/cache_1_3_121_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

BIN
storage/cache/cache_1_3_121_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
storage/cache/cache_1_3_122_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

BIN
storage/cache/cache_1_3_122_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
storage/cache/cache_1_3_122_orginal vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

BIN
storage/cache/cache_1_3_122_small vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
storage/cache/cache_1_3_123_big vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

BIN
storage/cache/cache_1_3_123_medium vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Some files were not shown because too many files have changed in this diff Show more