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

PTNOP's avatar
Level 1

Intervention - Image source not readable

Hello i want create a thumbnail with some image that i have uploud to the serve, the image is correct uplouded but when i try resize the image i get this error:

message: "Image source not readable" The code that uploud the image and than creats a thumbnail:

$list_id = $request->list_id; 
	$image = $request->file('file');
$ext = $image->getClientOriginalExtension();
$imageName = Str::random(20).'.'.$ext;
$path = 'public/images/list/'.$list_id;
    
if(!file_exists($path)){
        mkdir($path, 0777, true);
    }
    $image->move(public_path('images/list/'.$list_id), $imageName);
            $order = ListPhotos::where('list_id', $list_id)->orderBy('order', 'DESC')->first();
            if($order){ $serial = $order->order+1; }else{$serial = 1;}
            $photos = new ListPhotos();
            $photos->list_id     = $list_id;
            $photos->photo       =  $imageName;
            $photos->thumbnail   = "thumbnail_".$imageName;
            $photos ->order      = $serial;
            $photos->save();
    
    $image=$path."/".$imageName;
    $location = $path."/"."thumbnail_".$imageName;
    
    Image::make($image)->resize(360, null, function ($constraint)
                        { $constraint->aspectRatio();})
                       ->save($location);
    
    $thumbnail=getimagesize($location);
    if($thumbnail[1]>=181){
        Image::make($image)->resize(null, 180, function ($constraint)
                            { $constraint->aspectRatio();})
                           ->save($location);
    }
0 likes
2 replies
PTNOP's avatar
Level 1

Any ideia? I can't find anything :S

chilldsgn's avatar

I just ran into this issue and got it working with this:

$file = $request->file('logo');
// some other code to format the $file_name
Image::make($file->getRealPath())->resize(250, 250)->save('path/to/your/file' . $file_name);

Please or to participate in this conversation.