Hello guys!
What i am trying to do, is retrieve multiple images from database table and display them in my view. I tried to do that by creating a function actionDisplaySavedImage in my controller. Here is my code:
public function actionDisplaySavedImage()
{
$Criteria = new CDbCriteria();
$Criteria->select="start, end, ID, enabled, photo";
$Criteria->order = "end";
$records = Packages::model()->findAll($Criteria);
foreach ($records as $rec)
{
header('Content-Type: jpeg');
echo $rec->photo;
}
}
The problem is that if i call this action it only displays one image.
But if i try
echo $rec->ID
instead of
echo $rec->photo
it works ok.
What’s wrong??? There is nothing wrong with my images, i can display each of them seperately.
If this is not going to work, is there any other way to retrieve multiple images from db and display them to my view?