<?php
public function beforeFilter(\Cake\Event\Event $event)
{
$user = $this->request->session()->read('Auth.User');
$this->set('username', $user['username']);
$this->set('profile', $user['profile_pic'])
}
?>
內部輪廓圖像在上面的代碼中,我可以print
下面username
內部元素/文件夾/ nav.ctp如何顯示元件視圖
<?php
echo $this->Html->image('users/' .stream_get_contents($profile),array('width'=>'100px','height'=>'100px'));
?>
當我打印圖像,警告消息。
警告(2):stream_get_contents()預計參數1是資源,給定[APP /模板/元素/文件夾/ nav.ctp 19行]
你是否將圖像數據存儲在數據庫中或者只是文件名? – arilia
我的圖像字段是longblob,我存儲在數據庫中 – distromob
我還有一個字段名稱「destination」示例/opt/lampp/htdocs/mycakeapps/webroot/img/users/profile2.png – distromob