Unable To View Images Stored In A Blob Field Using Renderpartial


Followed this tutorial

http://www.yiiframework.com/wiki/332/storing-your-images-in-your-table-s-blob-field-and-displaying-that-stored-images that uses renderPartial with a view to display images

My systems specs

OS: CentOS release 6.3 (Final) / Windows 7 professional x64

Webservers: Apache/2.2.15 / Apache/2.2.22

Browsers: Chrome 21.0.1180.89 m, Firefox 15.0.1, Internet Explorer 9.08112.16421

Yii version: 1.1.12

Have moved to new server from a debian squeeze with Yii 1.1.10 due to disk failure, on the old machine all worked fine.

In the current server I cannot see the image displayed, but in google chrome I can download it and open with an editor, firefox tells me that there are some errors in the image.

Tried various solutions, checking permissions, encodings and collations, monitored headers without success.

The image displays correctly if I load it from the database using native mysql instructions of PHP but not if I include the instructions in a view and use renderPartial to display it.

Thanks in advance for any help

[color="#008000"]/* Moved from "Bug Discussions" to "General Discussion for Yii 1.1.x" */[/color]

Comment out header() line and see what’s actually sent to browser.

Yes, I have already tried this.

It displays binary characters as expected.

I have also tried generating and image with imagecreatetruecolor():


header('Content-Type: image/jpeg');

$im = imagecreatetruecolor(120, 20);

$text_color = imagecolorallocate($im, 233, 14, 91);

imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);






this is the result with headers: 3228


this is the result without headers: 3229


If I put the code above in a php file and I visit the page the image is displayed fine, if I remove the headers it displays the same characters above.