473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

php code to display image from mysql db

I have used the code of 'Atli' posted on Nov, 23 2007 to upload the images into the mysql database and it's working fine but i need some more help that is..

how to display image on browser that is stored in mysql database using php code?

Thanks.
Nov 19 '11 #1
5 2738
can you paste the URL to that post which you referred?
Nov 19 '11 #2
Hi.. pradeepkr13, The below is the url of the page consisting the code i referred.

http://bytes.com/topic/php/insights/...base-using-php
Nov 20 '11 #3
He has written everything, see,
Phase 3: Listing all existing files
Nov 20 '11 #4
Yes, I have gone through the Phase 3 code, where in instead of image, a link is displayed to download the image. But I want to display the image instead download.
I will be very thankful, if you help me to solve this issue.
Nov 21 '11 #5
He says,

"When a browser requests a file from a HTTP server, the server response includes info on what exactly it contains. These bits of info are called headers. The headers usually include infor on the type of data being sent, the size of the response, and in the case of files, the name of the file."
...
...
We start simply by reading the ID sent by the link in phase 3. If the ID is valid, we fetch the information on the file who's ID we received, send the headers, and finally send the file data."

And this is how he is showing the image ....

Expand|Select|Wrap|Line Numbers
  1. <a href='get_file.php?id={$row['id']}'>Download</a>
Note: get_file.php is another php file which does no HTML thing. It solely sends headers and the image in binary format.
So You should use two PHP files, 1 having HTML code (with img tag) and another just dumping the image with its headers. Something like this,
Expand|Select|Wrap|Line Numbers
  1. <img src='get_file.php?id={$row['id']}'>
Nov 22 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Philipp Lenssen | last post by:
I created Search.CSS which grabs Google results (using the Web API), displays as XHTML1.0 Strict + CSS, and recently also adds Thumbnails....
0
by: Qindong Zhang | last post by:
My asp.net application send image to web browser. The browser begin to display image before download finished. (In Slow Network). How can I force brower to display image after the image downloaded? ...
1
by: Tan | last post by:
Hi I am desperate for any help with display image in Gridview I have a gridview contain surname , forename ..... and image. I could not display image as my database store the column image as...
3
by: harish | last post by:
Hi friends I am facing problem as follow I can't display image from SQL Database to Picture box Control. Here are the codes that I am writing Dim arrPicture() As Byte = _
2
by: David | last post by:
I am trying to get an image to appear on all Mondays within the calendar control. I also want that image to be a link. How can I do this?
3
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
3
by: Ladislav Andel | last post by:
Hi, I'm trying to display image through my cgi script in HTML page via <img src="image.cgi"> Can you give me an example, please? What should be in the cgi script to display it? Here is what...
7
by: alexseow | last post by:
Query.asp <%@ LANGUAGE="VBSCRIPT" %> <!-- #include file="../../includes/dbconn.asp"--> <% dim MyRs, sqlstr, MyConn Response.Expires = 0 Response.Buffer = TRUE Response.Clear
6
by: vjayis | last post by:
hi i have stored user profile images in an BLOB field., and need to display it as an thumbnail image in their profile page., and i searched through the net and got the result using header...
0
by: dbdb | last post by:
hi, i work with ms. access 2003 i want to display image from a folder to the report. i have read thread in http://bytes.com/topic/access/answers/191611-pictures-access-reports but that's...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.