我正在使用 Laravel 框架和图像/干预库来生成带有动态数据的图像。该代码在我的本地计算机上运行得很好,但是当我将其上传到 aws ubuntu 实例上时,它就会显示错误,例如 Internal gd font() not available。我尝试切换到 imagick 和 public_path() 但它仍然显示相同的错误。我的代码如下:
我尝试切换到 imagick 和 public_path() 但它仍然显示相同的错误。我的代码如下:
公共函数generateIdCard(请求$请求){
$user = app('App\Http\Controllers\ApiTokenController')->authenticate($request);
if($user == null)
return response()->json(['message' => 'Token Invalid','status'=>0], 200);
$user = MatchmakerUser::where('id', $user->id)->first();
if($user){
$img=Image::make($this->url2.'2.png');
$filename = 'mmProfilePic_'.$user->id.'.jpg';
$profilepicurl=$this->url.$filename;
$img2=Image::make($profilepicurl)->resize(82,82);
$img->insert($img2,'top-left',22,24);
$name=$user->first_name.$user->last_name;
$img->text($name,115, 50, function($font) {
$font->file('../../../fonts/Poppins-Bold.ttf');
$font->size(18);
$font->color('#fff');
$font->valign('top');
});
$designation=$user->matchmaker_type;
$img->text($designation,115, 73, function($font) {
$font->file('../../../fonts/Poppins-Medium.ttf');
$font->size(10);
$font->color('#fff');
$font->valign('top');
});
$phone=$user->phone_number;
$img->text($phone,31, 129, function($font) {
$font->file('../../../fonts/Poppins-Medium.ttf');
$font->size(10);
$font->color('#4e4e4e');
$font->valign('top');
});
$location=$user->location;
$img->text($location,33, 148, function($font) { …Run Code Online (Sandbox Code Playgroud)