how do i put an image in my php script.
Alrightey.
Here's the fast way to do it:
[PHP]
<?php
header('Content-type: image/jpeg');
readfile($_REQUEST['imageNameOrWhatever'] . '.jpg');
exit;
?>
[/PHP]
Nothing should be before the opening <?php tag, or else your output won't look right.
Note that the request variable doesn't contain the full name of the file; this would prevent a resourceful cracker (or clueless User) from loading up, say, ssh_root_password.txt ("I'd been meaning to get rid of that!").
As for the good way to do it, well, you'll probably want to validate your $_REQUEST['imageNameOrWhatever'] variable, and just to be safe, you should probably prepend the path, so that the User only has control over the name of the image. E.g.,
[PHP]
readfile("$_SERVER[DOCUMENT_ROOT]/images/local/stuff/and/whatnot/$_REQUEST[imageNameOrWhatever].jpg");
[/PHP]
Beyond that, go nuts; just make sure that the contents of the image file is the ONLY thing that gets output.