Yii Framework Forum: Returning image content type - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Returning image content type Rate Topic: -----

#1 User is offline   Shiki 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 12-November 09

Posted 16 November 2009 - 11:40 PM

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
0

#2 User is offline   phpdevmd 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 16-April 09

Posted 17 November 2009 - 05:53 AM

Looks good to me.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users