ModifsModifs

This commit is contained in:
Cassandre Cantet 2017-10-03 17:11:49 +02:00
parent 0ddc6e835a
commit 6608d12b1c
3 changed files with 7 additions and 5 deletions

View File

@ -15,7 +15,6 @@
"symfony/process" : "3.*",
"intervention/image": "^2.4",
"intervention/imagecache": "^2.3",
"jenssegers/model": "^1.1",
"spatie/laravel-image-optimizer": "^1.1"
},
"autoload": {

View File

@ -3,6 +3,7 @@
namespace Meoran\Images\Http\Controllers;
use Closure;
use Illuminate\Http\Request;
use Laravel\Lumen\Routing\Controller as BaseController;
use Meoran\Images\Model\Image;
@ -21,11 +22,13 @@ class ImagesController extends BaseController
}
}
public function upload()
public function upload(Request $request)
{
$pathImage = storage_path('Sunset_at_Tiergarten_UHD.jpg');
$this->validate($request, [
'image' => 'required|file|image'
]);
$image = new Image(['content' => $pathImage]);
$image = new Image(['content' => $request->input('image')]);
$image->save();
return response()->json($image);

View File

@ -32,7 +32,7 @@ class ImagesServiceProvider extends ServiceProvider
public function loadRoutes()
{
$this->app->get('images/upload', [
$this->app->post('images/upload', [
'as' => 'uploadImage', 'uses' => '\Meoran\Images\Http\Controllers\ImagesController@upload'
]);