【发布时间】:2013-07-27 16:17:29
【问题描述】:
现在我的图片链接如下所示:
我需要它们看起来像这样:
我的图片存储在APP/uploads/userid/images/filename.jpg
这是我目前的看法:
<?php foreach($file as $files){?>
<?php echo $this->Html->link($files['Image']['filename'], array('controller' => 'images', 'action' => 'downloadImages', $files['Image']['filename']), array('class' => 'frame'));}?>
它可以正常工作,点击链接可以正确显示相关图像。
控制器sn-p供参考:
public function downloadImages($filename) {
$download = !empty($_GET['download']);
$idUser = $this->Auth->user('idUser');
$folder_url = APP.'uploads/'.$idUser.'/'.'images'.'/'.$filename;
$this->response->file($folder_url, array('download' => $download, 'name' => $filename));
return $this->response;
}
我需要做什么才能使图像显示为链接而不是文件名?
【问题讨论】:
-
我想显示图像而不是链接...希望您理解...现在写在线文件名在查看页面上回显而不是图像...
-
@AD7six 很抱歉写得不好。我已经更新了我的问题
-
好吧,谢谢你帮助我先生......真的很感谢你..如果我做错了什么,我深表歉意
-
抱歉@AD7six 它可以工作...好吧我没有看到您更新的答案...谢谢你我试过了..它工作..中间的代码..
-
k 这令人困惑 - 答案未删除,并且已删除投票。
标签: cakephp cakephp-2.0 cakephp-2.1 image-uploading