[英]Laravel imagecreatefromjpeg(): failed to open stream: No such file or directory
I am trying to create a certificate from an image by using laravel.我正在尝试使用 laravel 从图像创建证书。 When I try to use imagecreatefromjpeg() function inside HomeController its giving me error
当我尝试在 HomeController 中使用 imagecreatefromjpeg() function 时,它给了我错误
imagecreatefromjpeg(/storage/DY6Gdakkwfak2B96WJsgHFNRPx6NUng1c2Iw87nG.jpg): failed to open stream: No such file or directory
My code我的代码
HomeController家庭控制器
public function show_certificate(Request $request, Certificate $certificate){
header('content-type:image/jpeg');
$image = imagecreatefromjpeg(\Storage::url($certificate->certificateTemplate->template_path));
$color=imagecolorallocate($image,19,21,22);
$name="Vishal";
imagettftext($image,50,0,360,360,$color,$font,$name);
$imagejpeg($image);
return $image;
}
I solved this by using Storage::path()
Credits @Phil我通过使用
Storage::path()
Credits @Phil 解决了这个问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.