Jump to content

I Need A Script On How To Display Picture


Panta
 Share

Recommended Posts

Please friends please help me on how to display a picture that is in the data base on a browser, so that the user can see his uploded picture, and if possible print. thanks

Link to comment
Share on other sites

Which fields do you have in the database? Do you have the binary data and the original filename or extension?
yes i have both in my data base, so i need help on how to display the image so that thet user will see it on the browser
Link to comment
Share on other sites

Basically, all you need to do is output the correct content-type header based on what the original extension was, and then output the binary data. e.g., if the image is a PNG:header('Content-Type: image/png');header('Content-Length: . ' strlen($image_data));echo $image_data;You can use a script that outputs that as the src for an image tag, e.g.:<img src="get_image.php">

Link to comment
Share on other sites

header('Content-Length: '. strlen($image_data));
Quote and concatenator were back-to-front...
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...