Stuff
This commit is contained in:
parent
937357b135
commit
2c8457e60b
3 changed files with 22 additions and 2 deletions
|
@ -11,6 +11,7 @@ use Illuminate\Http\Request;
|
|||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Redirect;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class TenantController extends BaseController
|
||||
{
|
||||
|
@ -64,6 +65,16 @@ class TenantController extends BaseController
|
|||
]);
|
||||
$path = $validated["files"][0]->store("watermark/".session("current_tenant_id"));
|
||||
|
||||
$tenant = Tenant::query()->where("id", "=", session("current_tenant_id"))->firstOrFail();
|
||||
|
||||
$oldImage = Image::query()->where("id", "=", $tenant->watermark)->first();
|
||||
if(!is_null($oldImage)) {
|
||||
Storage::disk($image->driver)->delete($image->path);
|
||||
$oldImage->deleted_at = date("Y-m-d H:i:s");
|
||||
$oldImage->saveOrFail();
|
||||
}
|
||||
|
||||
|
||||
$image = new Image();
|
||||
$image->path = $path;
|
||||
$image->driver = env('FILESYSTEM_DRIVER', 'local');
|
||||
|
@ -73,7 +84,7 @@ class TenantController extends BaseController
|
|||
$image->typ = "watermark";
|
||||
$image->saveOrFail();
|
||||
|
||||
$tenant = Tenant::query()->where("id", "=", session("current_tenant_id"))->firstOrFail();
|
||||
|
||||
$tenant->watermark = $image->id;
|
||||
$tenant->saveOrFail();
|
||||
|
||||
|
|
|
@ -74,8 +74,9 @@ class ResizeImage implements ShouldQueue
|
|||
if($this->size > 500 && !is_null($tenant->watermark)) {
|
||||
Log::info("Add Watermark");
|
||||
|
||||
$cacheNameWatermark = "";
|
||||
|
||||
$waterMarkImage = Image::query()->where("id", "=", $tenant->watermark)->firstOrFail();
|
||||
$cacheNameWatermark = "watermark/".$waterMarkImage->id."_".$waterMarkImage->filename;
|
||||
$watermarkSource = $this->getImage($tenant, $gallery, $waterMarkImage, $cacheNameWatermark);
|
||||
|
||||
$watermark = $manager->make($watermarkSource);
|
||||
|
|
|
@ -97,6 +97,14 @@
|
|||
apt:
|
||||
name: php-zip
|
||||
state: present
|
||||
- name: Install imagemagick
|
||||
apt:
|
||||
name: imagemagick
|
||||
state: present
|
||||
- name: Install php-imagick
|
||||
apt:
|
||||
name: php-imagick
|
||||
state: present
|
||||
- name: Check that the /bin/composer exists
|
||||
stat:
|
||||
path: /bin/composer
|
||||
|
|
Loading…
Reference in a new issue