Added image view, next/previous and view update
This commit is contained in:
@@ -19,6 +19,19 @@ class PhotoController extends Controller
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
$po = Photo::notRemove()->findOrFail($id);
|
||||
|
||||
if ($po)
|
||||
{
|
||||
$po->remove = TRUE;
|
||||
$po->save();
|
||||
}
|
||||
|
||||
return redirect()->action('PhotoController@info',[$id]);
|
||||
}
|
||||
|
||||
public function info($id)
|
||||
{
|
||||
return view('photo.view', ['photo'=> Photo::findOrFail($id)]);
|
||||
@@ -26,6 +39,24 @@ class PhotoController extends Controller
|
||||
|
||||
public function thumbnail($id)
|
||||
{
|
||||
return (new Response(Photo::findOrFail($id)->thumbnail()))->header('Content-Type','image/jpg');
|
||||
return response(Photo::findOrFail($id)->thumbnail(TRUE))->header('Content-Type','image/jpeg');
|
||||
}
|
||||
|
||||
public function undelete($id)
|
||||
{
|
||||
$po = Photo::findOrFail($id);
|
||||
|
||||
if ($po)
|
||||
{
|
||||
$po->remove = NULL;
|
||||
$po->save();
|
||||
}
|
||||
|
||||
return redirect()->action('PhotoController@info',[$id]);
|
||||
}
|
||||
|
||||
public function view($id)
|
||||
{
|
||||
return response(Photo::findOrFail($id)->image())->header('Content-Type','image/jpeg');
|
||||
}
|
||||
}
|
||||
|
@@ -21,3 +21,6 @@ Route::auth();
|
||||
|
||||
Route::get('/info/{id}', 'PhotoController@info')->where('id', '[0-9]+');;
|
||||
Route::get('/thumbnail/{id}', 'PhotoController@thumbnail')->where('id', '[0-9]+');;
|
||||
Route::get('/view/{id}', 'PhotoController@view')->where('id', '[0-9]+');;
|
||||
Route::post('/delete/{id}', 'PhotoController@delete')->where('id', '[0-9]+');;
|
||||
Route::post('/undelete/{id}', 'PhotoController@undelete')->where('id', '[0-9]+');;
|
||||
|
Reference in New Issue
Block a user