Level 1
Any ideia? I can't find anything :S
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
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);
}
Please or to participate in this conversation.