Jump to content
Panta

I Need A Script On How To Display Picture

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

Share this post


Link to post
Share on other sites

Which fields do you have in the database? Do you have the binary data and the original filename or extension?

Share this post


Link to post
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

Share this post


Link to post
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">

Share this post


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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...