📅  最后修改于: 2022-03-11 14:58:25.026000             🧑  作者: Mango
case 'image/gif': $core = @imagecreatefromgif($path); break; case 'image/webp': case 'image/x-webp': if ( ! function_exists('imagecreatefromwebp')) { throw new NotReadableException( "Unsupported image type. GD/PHP installation does not support WebP format." ); } $core = @imagecreatefromwebp($path); break; default: throw new NotReadableException( "Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files." ); } if (empty($core)) { throw new NotReadableException( "Unable to decode image from file ({$path})." ); } $this->gdResourceToTruecolor($core); // build image $image = $this->initFromGdResource($core); $image->mime = $mime;