WideImage problem

Hi,

I’m facing a problem trying to use WideImage library, maybe this happened to someone before.

The probem is that the image does not display.

When I do this:




<img src='/mySite/user/avatar' alt='' />



is supposed to show the user avatar, but nothing happen.

When I try to pass the the src by the browser url (localhost/mySite/user/avatar), then a download dialog appears, but it should show the image.

Here is my code.




public function actionAvatar() {

        $user = $this->loadUser(Yii::app()->user-id);

        

        Yii::import('application.components.wideimage.*');

        $avatarPath = dirname(Yii::app()->request->scriptFile) . '/private/' . $user->folder . '/' . $user->avatar;

        $avatar = WideImage::load($avatarPath);

        $avatar->resize($avatar->getWidth() <= 32 ? $logo->getWidth() : 32)->output('jpg');

    }



I also tried passing the full path of the image in $avatarPath, like this "/path/to/image/image.jpg", and that works great.

The problem seems to be in the call to $this->loadUser, actually any call to a model. Don’t know if calling a data model could affect, but when I remove the call to the function and pass the raw url it works.

Summarizing.




//NOT WORKING

$user = $this->loadUser(Yii::app()->user-id);

$avatarPath = dirname(Yii::app()->request->scriptFile) . '/private/' . $user->folder . '/' . $user->avatar;


//WORK

//$user = $this->loadUser(Yii::app()->user-id); //remove this

$avatarPath = "/path/to/image/image.jpg";



Hope someone out there could help me.

Thanks in advance