PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Ok so Ive written a script that creates an image based on info from the url. I want people to be able to type something like this into a fourm and for my script to return an image.
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: Posting Code in the Forums to learn how to do it too.
K, I simplified it a little by taking some of the repetitive code out.
[EDIT] ive commented the code a little better so its easier to understand
Function GenerateIMG($ml,$c,$ini_array)
{
$path = "C:\\Users\\Administrator\\Pictures\\sig.jpeg";
if (!file_exists($path)) {
echo 'File does not exist.';
} else {
$im = imagecreatefromjpeg($path);
if (!headers_sent()) {
header('Content-type: image/jpeg');
imagejpeg($im);
}
}
imagedestroy($im);
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: Posting Code in the Forums to learn how to do it too.
Last edited by Rev0 on Thu Aug 27, 2009 1:26 pm, edited 1 time in total.
Remove the call to header() from line 10. As it is now, if your script outputs error messages, they will be included in the body of the image. This will cause the browser to display garbage.
Thanks for the input McInfo but its still not working :/
For debugging purposes Ive narrowed my code down to this to exclude anything that might be complicating the output, but its still spitting out jibberish.