Re: Broken image if shown with file_get_contents()
Can you please try with the following code? function view() { Configure::write('debug', 0); header('Content-type: image/jpeg;'); echo file_get_contents(WWW_ROOT . 'img' . DS . 'folder' . DS . 'test.jpg'); exit; } On Sun, Nov 2, 2008 at 4:36 AM, Giaco [EMAIL PROTECTED] wrote: 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? -- Anupom Syam http://syamantics.com/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Broken image if shown with file_get_contents()
I now found out then when viewed binarily the only difference between the real picture and the scrambled one of cake is: * one empty line at the top * line delimiter is CRLF not CR If I change those two, the image works as expected. How can I tell cake to show the image properly? On Nov 2, 11:10 am, Anupom [EMAIL PROTECTED] wrote: Can you please try with the following code? function view() { Configure::write('debug', 0); header('Content-type: image/jpeg;'); echo file_get_contents(WWW_ROOT . 'img' . DS . 'folder' . DS . 'test.jpg'); exit; } On Sun, Nov 2, 2008 at 4:36 AM, Giaco [EMAIL PROTECTED] wrote: 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? -- Anupom Syamhttp://syamantics.com/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Broken image if shown with file_get_contents()
That doesn’t work either. The path is correct, put the output gets scrambled. I think this is an encoding issue but I can’t work around it and don’t find anything on the web about it. Does this function work as expected with your cake installation? (I’m using UTF8) On Nov 2, 11:10 am, Anupom [EMAIL PROTECTED] wrote: Can you please try with the following code? function view() { Configure::write('debug', 0); header('Content-type: image/jpeg;'); echo file_get_contents(WWW_ROOT . 'img' . DS . 'folder' . DS . 'test.jpg'); exit; } On Sun, Nov 2, 2008 at 4:36 AM, Giaco [EMAIL PROTECTED] wrote: 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? -- Anupom Syamhttp://syamantics.com/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Broken image if shown with file_get_contents()
It works fine here! Did you try exiting at the end of the action? On Sun, Nov 2, 2008 at 7:48 PM, Giaco [EMAIL PROTECTED] wrote: That doesn't work either. The path is correct, put the output gets scrambled. I think this is an encoding issue but I can't work around it and don't find anything on the web about it. Does this function work as expected with your cake installation? (I'm using UTF8) On Nov 2, 11:10 am, Anupom [EMAIL PROTECTED] wrote: Can you please try with the following code? function view() { Configure::write('debug', 0); header('Content-type: image/jpeg;'); echo file_get_contents(WWW_ROOT . 'img' . DS . 'folder' . DS . 'test.jpg'); exit; } On Sun, Nov 2, 2008 at 4:36 AM, Giaco [EMAIL PROTECTED] wrote: 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? -- Anupom Syamhttp://syamantics.com/ -- Anupom Syam http://syamantics.com/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Broken image if shown with file_get_contents()
Maybe you forgot whitespace after closing a php tag. Anupom wrote: It works fine here! Did you try exiting at the end of the action? On Sun, Nov 2, 2008 at 7:48 PM, Giaco [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: That doesn't work either. The path is correct, put the output gets scrambled. I think this is an encoding issue but I can't work around it and don't find anything on the web about it. Does this function work as expected with your cake installation? (I'm using UTF8) On Nov 2, 11:10 am, Anupom [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Can you please try with the following code? function view() { Configure::write('debug', 0); header('Content-type: image/jpeg;'); echo file_get_contents(WWW_ROOT . 'img' . DS . 'folder' . DS . 'test.jpg'); exit; } On Sun, Nov 2, 2008 at 4:36 AM, Giaco [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: 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? -- Anupom Syamhttp://syamantics.com/ http://syamantics.com/ -- Anupom Syam http://syamantics.com/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Broken image if shown with file_get_contents()
On Sun, Nov 2, 2008 at 10:33 AM, Bernardo Vieira [EMAIL PROTECTED] wrote: Maybe you forgot whitespace after closing a php tag. My guess is that you have a controller, component, helper that has an extra white space at the start or end. You could try clearing the output buffer http://us3.php.net/manual/en/function.ob-clean.php before echoing out the file and then exiting http://us3.php.net/manual/en/function.exit.php like Configure::write('debug', 0); ob_clear(); header('Content-type: image/jpeg;'); file_get_contents(WWW_ROOT . 'img' . DS . 'folder' . DS . 'test.jpg'); exit; Anupom wrote: It works fine here! Did you try exiting at the end of the action? On Sun, Nov 2, 2008 at 7:48 PM, Giaco [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: That doesn't work either. The path is correct, put the output gets scrambled. I think this is an encoding issue but I can't work around it and don't find anything on the web about it. Does this function work as expected with your cake installation? (I'm using UTF8) On Nov 2, 11:10 am, Anupom [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Can you please try with the following code? function view() { Configure::write('debug', 0); header('Content-type: image/jpeg;'); echo file_get_contents(WWW_ROOT . 'img' . DS . 'folder' . DS . 'test.jpg'); exit; } On Sun, Nov 2, 2008 at 4:36 AM, Giaco [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: 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? -- Anupom Syamhttp://syamantics.com/ http://syamantics.com/ -- Anupom Syam http://syamantics.com/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---