mrestufp20's avatar

Class App\Http\Controllers\ImageController does not exist

Controller Here

namespace App\Http\Controllers;

use Illuminate\Http\Request; use App\Http\Requests; use Image;

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 = $request->file('image');
    $input['imagename'] = time().'.'.$image->getClientOriginalExtension();
 

    $destinationPath = public_path('/thumbnail');
    $img = Image::make($image->getRealPath());
    $img->resize(100, 100, function ($constraint) {
        $constraint->aspectRatio();
    })->save($destinationPath.'/'.$input['imagename']);

    $destinationPath = public_path('/images');
    $image->move($destinationPath, $input['imagename']);

    //$this->postImage->add($input);

    return back()
        ->with('success','Image Upload successful')
        ->with('imageName',$input['imagename']);
}

}

And Routes Here

0 likes
3 replies
kerrin's avatar

Did you create the controller using php artisan make:controller ImageController

Snapey's avatar

make sure you use the same capitalisation everywhere

Please or to participate in this conversation.