Saturday, November 1, 2008

Broken image if shown with file_get_contents()

Hello,

for security reasons and on the fly resizing I route all picture
requests to /images/view ("images" being the controller).

But this function outputs only a broken image:

/* images controller (for testing purposes no use of view and layout)
*/
function view() {
Configure::write('debug', 0);
header('Content-type: image/jpeg;');
echo file_get_contents("img/folder/test.jpg");
}

When I don't send the header, I see the binary version of the image.
What could this possibly be?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: