Returning image content type

Hi,

I’m new to Yii and still confused with some parts. What’s the correct/preferred way to return an image content type in Yii? I did this and it seemed to work:

$image = imagecreatefromjpeg($savedImageFullPath);

header("Content-type: image/jpeg");

imagejpeg($image);

Yii::app()->end();

I don’t feel that this is the best way though. Is there another way to do this?

Thanks

Looks good to me.