I have my photo folder stored in the data folder in a Zend Framework application. when i try to read the image files from the data folder to display as a user profile photo in my view i cant get it display and it only show up when i disable my view and layout.
This is my sample code:
$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;
I want to get the profile photos and display it in the user profile page
hope someone can help - thanks
you can use this, but has problem with some older versions of IE
Why are you trying to set a header as type image/jpeg?
Can you not just set $this->view->logo = /path/to/jpeg
Then in your view script
<img src="<?php echo $this->logo; ?>" alt="" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.