<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Helpers\ImageHelper;

class ImageController extends Controller
{
    //
     /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function resizeImage()
    {
        return view('resizeImage');
    }
  
    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function resizeImagePost(Request $request)
    {
        $this->validate($request, [
            // 'title' => 'required',
            'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
        ]);
  
        $image = ImageHelper::upload($request->file('image'));
   		
        return back()
            ->with('success','Image Upload successful')
            ->with('imageName',$image);
    }
}
