【发布时间】:2011-11-01 13:58:48
【问题描述】:
我的照片文件夹存储在 Zend Framework 应用程序的数据文件夹中。当我尝试从数据文件夹中读取图像文件以在我的视图中显示为用户个人资料照片时,我无法显示它,它仅在我禁用视图和布局时才显示。
这是我的示例代码:
$appShortPath = $photPlugin->getPathToFileFolders();
$databaseFile = '2011/08/18/17c7025cd9f3436e4ad1c02635cc6754.jpg';
$appPath = $appShortPath . '/data/UploadPhotos/';
if(!isset($databaseFile))
{
return false;
}
$fullPath = $appPath . $databaseFile;
if(!file_exists($fullPath))
{
return false;
}
$this->_helper->viewRenderer->setNoRender(true);
$this->view->layout()->disableLayout();
$image = readfile($fullPath);
header('Content-Type: image/jpeg');
$this->getResponse()
->setHeader('Content-Type', 'image/jpeg');
$this->view->logo = $image;
我想获取个人资料照片并将其显示在用户个人资料页面中
希望有人能帮忙 - 谢谢
【问题讨论】:
标签: php zend-framework profile photo