1

我有一个存储在数据库中的图像路径字符串

它就像:img/uploads/imagename.jpg

我有一个控制器:

$this->image = new Image($wines->image)

//this is assuming that I have a wines table with the image property

$this->image->resize(60, 250, Image::AUTO)

echo $this->image->render();

//the problem is nothing is rendered

//Is there a better way of doing this? the image path that I am passing at the Image object //instantiation is the result of a query
4

2 回答 2

0
  1. 不要使用“回声”
  2. 将渲染移动到视图
于 2009-07-30T18:12:20.990 回答
0

您不需要使用回声本身。render() 本身将输出回显到浏览器。也许,您需要根据文档使用 render(true)。 http://docs.kohanaphp.com/libraries/image#render

编辑:还要小心路径。如果可能,请使用绝对路径,或者最好使用相对于文档根目录的路径。

于 2009-11-17T09:02:29.623 回答