Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

图像因存在错误而无法显示 #139

Closed
sleepgod opened this issue Dec 4, 2014 · 1 comment
Closed

图像因存在错误而无法显示 #139

sleepgod opened this issue Dec 4, 2014 · 1 comment

Comments

@sleepgod
Copy link

sleepgod commented Dec 4, 2014

public function indexAction() {
$response = $this->getResponse();
$response->clearBody();
$response->setHeader('Content-Type', 'image/jpeg');
$response->response();
$im = imagecreatetruecolor(120, 40);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
header('Content-Type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
return FALSE;
}
// 上面的代码放在yaf中浏览器显示不了图像,提示“图像因存在错误而无法显示”。而同样的代码之间放在一个php文件中执行就没有问题,可以显示。请问是什么地方有问题?

@laruence
Copy link
Owner

laruence commented Dec 4, 2014

你把图像下载下来, 用二进制编辑器打开, 看看头部是不是有什么奇怪的东西跑进去了.....

@laruence laruence closed this as completed Aug 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants