dsgfdgh14569 2015-11-27 09:51
浏览 38
已采纳

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

The following error is generated by drupal site creating an image using imagecreatefromjpeg and imagejpeg:

The image “http://domain.com/dbtransfer” cannot be displayed because it contains errors.

I enabled error display and checked the error log but no errors are display. There aren't any messages displaying. All the paths are correct as well as all variables are correct.

Creating and writing data into mpdf image but it's not working here.

$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条回答 默认 最新

  • doutu3352 2015-11-28 14:37
    关注

    I edited image file and found error in it. Its fixed now.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?