无法显示图像“path”,因为它包含错误

时间:2015-11-27 09:51:23

标签: php drupal mpdf

drupal网站使用imagecreatefromjpegimagejpeg创建图片时会产生以下错误:

  

无法显示图像“http://domain.com/dbtransfer”,因为它包含错误。

我启用了错误显示并检查了错误日志,但没有显示错误。没有任何消息显示。所有路径都是正确的,所有变量都是正确的。

创建并将数据写入mpdf图像,但它在这里不起作用。

$img=imagecreatefromjpeg(DRUPAL_ROOT . '/sites/all/themes/journalcrunch/images/pdfbg.jpg');       
$image_text="Publisher:";
$image_text1="$publisherpdf";
$image_text2="Pricing:";
$image_text3="Single User License:";
$image_text4="US $ $sulpdf";
$image_text5="Corporate User License:";
$image_text6="US $ $culpdf";
$image_text7="Category:";
$image_text8="$categoriespdf";
$image_text9="No. of Pages: $pagespdf";
$red=rand(100,30); 
$green=rand(100,60);
$blue=rand(100,95);
$text_color=imagecolorallocate($img,30,60,95);
$text=imagettftext($img,9,0,25,145,$text_color,"fonts/arialbd.ttf",$image_text);
$text=imagettftext($img,10,0,25,170,$text_color,"fonts/arialbd.ttf",$image_text1);
$text=imagettftext($img,10,0,25,215,$text_color,"fonts/arialbd.ttf",$image_text2);
$text=imagettftext($img,9,0,25,235,$text_color,"fonts/arialbd.ttf",$image_text3);
$text=imagettftext($img,9,0,25,255,$text_color,"fonts/arialbd.ttf",$image_text4);
$text=imagettftext($img,9,0,25,275,$text_color,"fonts/arialbd.ttf",$image_text5);
$text=imagettftext($img,9,0,25,295,$text_color,"fonts/arialbd.ttf",$image_text6);
$text=imagettftext($img,9,0,25,340,$text_color,"fonts/arialbd.ttf",$image_text7);
$text=imagettftext($img,10,0,25,365,$text_color,"fonts/arialbd.ttf",$image_text8);
$text=imagettftext($img,10,0,25,410,$text_color,"fonts/arialbd.ttf",$image_text9);

header("Content-type:image/jpeg");
header("Content-Disposition:inline ; filename=secure.jpg"); 
imagejpeg($img,"images/".$lastnid.".jpg",100);

1 个答案:

答案 0 :(得分:0)

我编辑了图像文件并发现了错误。现在修好了。