����JFIF��x�x����'
Server IP : 78.140.185.180 / Your IP : 3.12.165.112 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/public_html/app/Http/Controllers/ |
Upload File : |
<?php namespace App\Http\Controllers; use App\Project; use Common\Core\BaseController; use Illuminate\Http\Request; use Image; use Intervention\Image\Constraint; use Storage; class ProjectThumbnailController extends BaseController { /** * @var Request */ private $request; /** * @var Project */ private $project; public function __construct(Request $request, Project $project) { $this->request = $request; $this->project = $project; } public function store($projectId) { $project = $this->project->find($projectId); $this->authorize('update', $project); $userId = $this->request->user()->id; $path = "$userId/$project->uuid/thumbnail.png"; $thumbnail = $this->generateThumbnail(); Storage::disk('projects')->put($path, $thumbnail); return $this->success(['path' => $path]); } private function generateThumbnail(): string { $string = preg_replace('/data:image\/.+?;base64,/', '', $this->request->get('dataUrl')); $img = Image::make(base64_decode($string)); $img->fit(385, 240); return $img->encode('jpg', 100); } }