为什么imagecreatefromjpeg不能在yii框架中工作?

为什么imagecreatefromjpeg不能在yii框架中工作?,yii,Yii,我试图在yii中在运行时调整图像大小,但不起作用 我在视图中尝试了此代码,但它不起作用 我在view.php中的代码 控制器中的我的代码 public function actionImage() { $this->render('image'); } 输出html <html debug="true"> <body style="margin: 0px; "> <img style="-webkit-user

我试图在yii中在运行时调整图像大小,但不起作用

我在视图中尝试了此代码,但它不起作用

我在view.php中的代码

控制器中的我的代码

    public function actionImage()
    {
            $this->render('image');
    }
输出html

<html debug="true">
<body style="margin: 0px; ">
<img style="-webkit-user-select: none; " src="http://localhost/yiiadministration/index.php?r=administration/products/image"/>
</body>
<script src="chrome-extension://bmagokdooijbeehmkpknfglimnifench/googleChrome.js"/>
</html>
附则;视图中的代码只是查看操作,而不是缩放图像,因为我通常在php中这样做


有人能帮忙吗?

在呈现视图之前,已经发送了一个标头,因此您的代码尝试发送一个新标头,但由于已经发送,因此失败

您可以从控制器发送该标头,也可以在视图中使用img标记,如前所述


此外,imagejpeg还将图像直接输出到浏览器,因此回音在该上下文中是错误的。

是否安装了GD模块?apache日志显示了什么?在调用$image=imagecreatefromjpeg'image.jpg';之后,var_转储$image输出的是什么;。$image是有效的资源吗?顺便说一句:回波图像JPEG$图像;没有意义,如imagejpeg$image;返回一个无法回送的布尔值。
<html debug="true">
<body style="margin: 0px; ">
<img style="-webkit-user-select: none; " src="http://localhost/yiiadministration/index.php?r=administration/products/image"/>
</body>
<script src="chrome-extension://bmagokdooijbeehmkpknfglimnifench/googleChrome.js"/>
</html>