sementara
This commit is contained in:
27
Http/Controllers/ImageController.php
Normal file
27
Http/Controllers/ImageController.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Modules\Lpj\app\Services\ImageResizeService;
|
||||
|
||||
class ImageController extends Controller
|
||||
{
|
||||
protected $imageService;
|
||||
|
||||
public function __construct(ImageResizeService $imageService)
|
||||
{
|
||||
$this->imageService = $imageService;
|
||||
}
|
||||
|
||||
public function show(Request $request, $path)
|
||||
{
|
||||
$width = $request->query('w');
|
||||
$quality = $request->query('q', 80);
|
||||
|
||||
$resizedPath = $this->imageService->resize($path, $width, null, $quality);
|
||||
|
||||
return response()->file(storage_path('app/public/' . $resizedPath));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user