简体   繁体   English

imagejpeg不显示图像

[英]imagejpeg do not show an a image

I'm trying generate a certificate to print, but the only thing that happens is show a empty square in screen: 我正在尝试生成要打印的证书,但是唯一发生的是在屏幕上显示一个空的正方形:

在此处输入图片说明

I'm trying show the image on the screen before i try to write on it. 我尝试在屏幕上显示图像之前尝试在其上书写。

header("Content-type: image/jpeg");
$imagem = imagecreatefromjpeg("assets/img/certificado.jpg");
imagejpeg($imagem);

I already check the gd2 extension and it's enable: 我已经检查了gd2扩展名并启用了它: 在此处输入图片说明

And I check the php error log and the page who run this code dont return any error. 而且我检查了php错误日志,运行此代码的页面未返回任何错误。

When I remove the header("Content-type:image/jpeg"); 当我删除header("Content-type:image/jpeg"); and put a var_dump($i) it shows me this: resource(12,gd) 并放一个var_dump($i)它告诉我: resource(12,gd)

Sorry for my english and thanks! 对不起,我的英语,谢谢!

$our_image = imagecreatefromjpeg('upload/promo/flyer_hindi.jpg');
$white_color = imagecolorallocate($our_image, 0, 0, 0);
$font_path = 'upload/promo/CALIBRIB.TTF';
$text = 'some text';
$size = 70;
$angle = 0;
$left = 420;
enter code here
imagettftext($our_image, $size, $angle, $left, $top, $white_color, $font_path, $text);
imagejpeg($our_image, 'upload/promo/' . $id . '.jpg', 80);

i tried this code a last year, i upload a flyer and add some text on fix location and save. 去年,我尝试了此代码,我上传了传单,并在修复位置添加了一些文字并保存。 i think you need the same. 我认为你需要同样的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM