diff --git a/SRC/app/Http/Controllers/ReferentController.php b/SRC/app/Http/Controllers/ReferentController.php index a69bea3..3d18fd6 100755 --- a/SRC/app/Http/Controllers/ReferentController.php +++ b/SRC/app/Http/Controllers/ReferentController.php @@ -14,6 +14,8 @@ use App\Models\Oeuvre; use App\Models\Jeu; use Response; use Session; +use Config; +use File; class ReferentController extends Controller { @@ -166,4 +168,33 @@ class ReferentController extends Controller { $ListeOeuvre->jeux()->sync($table); } + public function getImage($filename) { + + // Append the filename to the path where our images are located + $path = Config::get('view.images') . $filename; + print($path); + + // Initialize an instance of Symfony's File class. + // This is a dependency of Laravel so it is readily available. + $file = new Symfony\Component\HttpFoundation\File\File($path); + + // Make a new response out of the contents of the file + // Set the response status code to 200 OK + $response = Response::make( + File::get($path), + 200 + ); + + // Modify our output's header. + // Set the content type to the mime of the file. + // In the case of a .jpeg this would be image/jpeg + $response->header( + 'Content-type', + $file->getMimeType() + ); + + // We return our image here. + return $response; + } + } diff --git a/SRC/app/Http/routes.php b/SRC/app/Http/routes.php index 8b814ee..ac46dfb 100644 --- a/SRC/app/Http/routes.php +++ b/SRC/app/Http/routes.php @@ -45,6 +45,7 @@ Route::group(['middleware' => 'auth'], function () Route::post('search', 'ReferentController@search'); Route::post('addItemsToList', 'ReferentController@addItemsToList'); Route::post('updateAssoGames', 'ReferentController@updateAssoGames'); + Route::get('showPic/{file}', 'ReferentController@getImage'); }); Route::group(['middleware' => 'admin'], function () diff --git a/SRC/config/view.php b/SRC/config/view.php index 88fc534..c88e5d3 100755 --- a/SRC/config/view.php +++ b/SRC/config/view.php @@ -27,6 +27,7 @@ return [ | directory. However, as usual, you are free to change this value. | */ + 'images' => './../resources/assets/images/', 'compiled' => realpath(storage_path().'/framework/views'), diff --git a/SRC/resources/assets/images/YOURIMAGE.jpg b/SRC/resources/assets/images/YOURIMAGE.jpg new file mode 100755 index 0000000..9dc626b Binary files /dev/null and b/SRC/resources/assets/images/YOURIMAGE.jpg differ diff --git a/SRC/resources/views/referent.blade.php b/SRC/resources/views/referent.blade.php index cc2630a..1bc8713 100755 --- a/SRC/resources/views/referent.blade.php +++ b/SRC/resources/views/referent.blade.php @@ -96,9 +96,9 @@
- +
- @foreach ($data['designation'] as $val)