Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

priyasanka00's avatar

Image source not readable in cpanel

The above error is coming on cpanel, but my local server is properly working intervention image with resizing, please help me,

this is my controller which has working in local server:

public function store(Request $request ){

//dd($request->all());
//if ($request->hasFile('image'))
$this->validate($request,[
    'yourname'=>'required|max:30',
    'email'=>'required',
    'tp'=>'required|max:10|min:9',
    'location'=>'required',
    'subject'=>'required|max:41|min:4',
    'message'=>'required',
    'price'=>'required|numeric',
    'category'=>'required|numeric',
    'image'=>'required',
    'image2'=>'required',
    'image3'=>'required',
]);


if($request->hasFile('image')){
$filename = $request->image->getClientOriginalName();
$filepath = str_replace('','/','storage/' . $filename);
$request->image->storeAs('public',$filename); 

{
    $img = Image::canvas(800, 600, '#EAEDED');
    $thumbnailpath = public_path('storage/'.$filename);
    $img2 = Image::make($thumbnailpath)->resize(800, 600, function($constraint) {
        $constraint->aspectRatio();
    });
    $img->insert($img2, 'center');
    
    $img->save($thumbnailpath);}
}
0 likes
0 replies

Please or to participate in this conversation.