severndigital Posted November 20, 2011 Share Posted November 20, 2011 As of this morning, I am unable to directly output any images from gd or imagemagick if i save them, to a file the exact same code works fine. when I try to display the images directly to the browser i get this error The image “http://www.mineposter.com/testing” cannot be displayed because it contains errors. I am trying to determine what has changed, but I am having difficulty figuring it out, since nothing has changed that I can tell. has anyone else experienced this? and if so, what did you do to fix it? again .. the exact same code works if i save the file and then display it. Quote Link to comment https://forums.phpfreaks.com/topic/251462-gd-and-imagemagick-direct-output-just-stopped-working/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 20, 2011 Share Posted November 20, 2011 Your script that is producing the image is probably outputting some characters either before or after the image data. When you have the script save the image as a file, those extra characters are not saved with the file. Make sure that there are no extra characters before the first opening <?php tag or after the last closing ?> tag and that you are not echoing anything, producing any php errors, or have any closing/opening php tags that have some white-space between them. Quote Link to comment https://forums.phpfreaks.com/topic/251462-gd-and-imagemagick-direct-output-just-stopped-working/#findComment-1289645 Share on other sites More sharing options...
severndigital Posted November 20, 2011 Author Share Posted November 20, 2011 i've checked that like a dozen times. the exact script worked yesterday and now does not. the only that was different is that the server was rebooted. on the reboot it stopped working. Quote Link to comment https://forums.phpfreaks.com/topic/251462-gd-and-imagemagick-direct-output-just-stopped-working/#findComment-1289663 Share on other sites More sharing options...
PFMaBiSmAd Posted November 20, 2011 Share Posted November 20, 2011 It's likely that your php.ini settings changed or reverted to the default for either output_buffering or error_reporting/display_errors and your file that dynamically produces the image is outputting something in addition to the content-type header and the image data. Comment out the content-type header statement and browse directly to the URL of your file that produces the image to see if there are any php errors being output or if you can then see any characters before or after the image data, in comparison to the image that you are having the code save to a file. Quote Link to comment https://forums.phpfreaks.com/topic/251462-gd-and-imagemagick-direct-output-just-stopped-working/#findComment-1289675 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.