You save the image with a webp extension (even though it might contain jpg and png) and then try to reload it with intervention?
Why not just load it straight into intervention rather than saving to disk first with the wrong extension?
Hello I have multi images upload system, it works fine when I upload images with ext of JPG but when I try to upload .png images it throw back an error
Intervention\Image\Exception\NotReadableException
Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files.
and am sure that the images are in .png format and I get the same error when upload mix between .jpg and PNG images here is the code I am using, and I am using Traits to upload images
public function uploadImagesThumbs($request, $imFolder, $game){
foreach ($request->file('g_high_img') as $imgThumb) {
$imgFullName = $imgThumb->getClientOriginalName();
$explodeImgFullName = explode('.', $imgFullName);
// get the image name without the ext
$imgThumbName = current($explodeImgFullName);
$imgThumbName = preg_replace('/[^a-zA-Z0-9]/', '-', strtolower($imgThumbName));
//the file name that well be saved
$imgThumbNameToStore = $imgThumbName.'_'.rand().'.webp';
Storage::put('public/'.$imFolder.'/'.$game->g_page_link.'/thumbnails/'.$imgThumbNameToStore,
fopen($imgThumb, 'r+'));
$image = Image::make($imgThumb);
$image->resize(700,400)->save(storage_path('app/public/'.$imFolder.'/'.
$game->g_page_link.'/thumbnails/'. $imgThumbNameToStore));
$image->resize(100,100)->save(storage_path('app/public/'.$imFolder.'/'.
$game->g_page_link.'/thumbnails/sm_'. $imgThumbNameToStore));
$this->imgThumbNameArray[] = $imgThumbNameToStore;
}
}
And I am allowing the user to upload .png images
Please or to participate in this conversation.