473,396 Members | 2,154 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,396 software developers and data experts.

Displaying an image from inside Mysql database..


Ok. what I want to do, is have pictures as BLOBS in a database.

And show them onscreen.

If I have a generic program called say - showpic.php - which is capable
of spitting out an image suitable for downloading, and I write a bit of
HTML like

<IMG URL="showpic.php?id=1112233456">Picture of item 1112233456</IMG>

where the id is and index to the actual picture I want, for example,
will that work?
Sep 14 '07 #1
9 2203
On 14 Sep, 11:55, The Natural Philosopher <a...@b.cwrote:
Ok. what I want to do, is have pictures as BLOBS in a database.

And show them onscreen.

If I have a generic program called say - showpic.php - which is capable
of spitting out an image suitable for downloading, and I write a bit of
HTML like

<IMG URL="showpic.php?id=1112233456">Picture of item 1112233456</IMG>

where the id is and index to the actual picture I want, for example,
will that work?
It will only work if the script executed from showpic.php reads the
data from the database and sends it with the correct headers to the
browser.

Sep 14 '07 #2
Captain Paralytic wrote:
On 14 Sep, 11:55, The Natural Philosopher <a...@b.cwrote:
>Ok. what I want to do, is have pictures as BLOBS in a database.

And show them onscreen.

If I have a generic program called say - showpic.php - which is capable
of spitting out an image suitable for downloading, and I write a bit of
HTML like

<IMG URL="showpic.php?id=1112233456">Picture of item 1112233456</IMG>

where the id is and index to the actual picture I want, for example,
will that work?

It will only work if the script executed from showpic.php reads the
data from the database and sends it with the correct headers to the
browser.
Thanks buddy!

That is down to debugging, that's all.

How does the browser know if its a jpeg or a gif? Mime type I guess? OK.
That all makes sense.
Sep 14 '07 #3
..oO(The Natural Philosopher)
>How does the browser know if its a jpeg or a gif? Mime type I guess?
Correct. For example

header('Content-Type: image/jpeg');

Micha
Sep 14 '07 #4
Michael Fesser wrote:
.oO(The Natural Philosopher)
>How does the browser know if its a jpeg or a gif? Mime type I guess?

Correct. For example

header('Content-Type: image/jpeg');

Micha
Ok. Thats all coded in now anyway. I'll test later. Many thanks all.
Sep 14 '07 #5
On 14 Sep, 15:00, The Natural Philosopher <a...@b.cwrote:
Michael Fesser wrote:
.oO(The Natural Philosopher)
How does the browser know if its a jpeg or a gif? Mime type I guess?
Correct. For example
header('Content-Type: image/jpeg');
Micha

Ok. Thats all coded in now anyway. I'll test later. Many thanks all.
BTW, I used this as a resource to save writing it all from scratch:

http://www.onlamp.com/pub/a/onlamp/2...09/webdb2.html

Sep 14 '07 #6
Captain Paralytic wrote:
On 14 Sep, 15:00, The Natural Philosopher <a...@b.cwrote:
>Michael Fesser wrote:
>>.oO(The Natural Philosopher)
How does the browser know if its a jpeg or a gif? Mime type I guess?
Correct. For example
header('Content-Type: image/jpeg');
Micha
Ok. Thats all coded in now anyway. I'll test later. Many thanks all.

BTW, I used this as a resource to save writing it all from scratch:

http://www.onlamp.com/pub/a/onlamp/2...09/webdb2.html
Well I've done it all, but it still doesn't work.

On safari a direct call to the program nets me a question mark graphic,
in Firefox it just echoes the browser URL..

Inside teh actual display I just get a fractured graphic symbol..
Sep 15 '07 #7
The Natural Philosopher wrote:
Captain Paralytic wrote:
>On 14 Sep, 15:00, The Natural Philosopher <a...@b.cwrote:
>>Michael Fesser wrote:
.oO(The Natural Philosopher)
How does the browser know if its a jpeg or a gif? Mime type I guess?
Correct. For example
header('Content-Type: image/jpeg');
Micha
Ok. Thats all coded in now anyway. I'll test later. Many thanks all.

BTW, I used this as a resource to save writing it all from scratch:

http://www.onlamp.com/pub/a/onlamp/2...09/webdb2.html
Well I've done it all, but it still doesn't work.

On safari a direct call to the program nets me a question mark graphic,
in Firefox it just echoes the browser URL..

Inside teh actual display I just get a fractured graphic symbol..

Oh..it works inside the program now, but not as a standalone. Hmm.

I had an SQL permissions problem..
Sep 15 '07 #8
The Natural Philosopher wrote:
The Natural Philosopher wrote:
>Captain Paralytic wrote:
>>On 14 Sep, 15:00, The Natural Philosopher <a...@b.cwrote:
Michael Fesser wrote:
.oO(The Natural Philosopher)
>How does the browser know if its a jpeg or a gif? Mime type I guess?
Correct. For example
header('Content-Type: image/jpeg');
Micha
Ok. Thats all coded in now anyway. I'll test later. Many thanks all.

BTW, I used this as a resource to save writing it all from scratch:

http://www.onlamp.com/pub/a/onlamp/2...09/webdb2.html
Well I've done it all, but it still doesn't work.

On safari a direct call to the program nets me a question mark
graphic, in Firefox it just echoes the browser URL..

Inside teh actual display I just get a fractured graphic symbol..

Oh..it works inside the program now, but not as a standalone. Hmm.

I had an SQL permissions problem..
Hi,

A little tip that saved me some time during the type of work you do now:
If you think your script is screwing up somewhere, and you want to see
the errors, simply change the header for mimetype into text/plain, and
call the image directly from the browser.

You won't see the image, but you will see notices and such.
(Of course you can also look into the errorlog, but that is such a hassle)
Once you receive a bunch a data that doesn't make sense, you propably
have the image delivered, and it is time to put the old header back. ;-)

Regards,
Erwin Moller
Sep 18 '07 #9
Erwin Moller wrote:
The Natural Philosopher wrote:
>The Natural Philosopher wrote:
>>Captain Paralytic wrote:
On 14 Sep, 15:00, The Natural Philosopher <a...@b.cwrote:
Michael Fesser wrote:
>.oO(The Natural Philosopher)
>>How does the browser know if its a jpeg or a gif? Mime type I guess?
>Correct. For example
>header('Content-Type: image/jpeg');
>Micha
Ok. Thats all coded in now anyway. I'll test later. Many thanks all.

BTW, I used this as a resource to save writing it all from scratch:

http://www.onlamp.com/pub/a/onlamp/2...09/webdb2.html

Well I've done it all, but it still doesn't work.

On safari a direct call to the program nets me a question mark
graphic, in Firefox it just echoes the browser URL..

Inside teh actual display I just get a fractured graphic symbol..

Oh..it works inside the program now, but not as a standalone. Hmm.

I had an SQL permissions problem..

Hi,

A little tip that saved me some time during the type of work you do now:
If you think your script is screwing up somewhere, and you want to see
the errors, simply change the header for mimetype into text/plain, and
call the image directly from the browser.

You won't see the image, but you will see notices and such.
(Of course you can also look into the errorlog, but that is such a hassle)
Once you receive a bunch a data that doesn't make sense, you propably
have the image delivered, and it is time to put the old header back. ;-)

Regards,
Erwin Moller
Mm. I sorta did that.

There were two issues..one is my test database had not got the right
permissions - there is something odd gong on because according to my
understanding the user had full rights, but I had to give that user full
rights in the database as well. Odd. Anyway that was half the problem.

The second half is that while the image now pops up when and IMG tag is
wrapped round it, a direct call to the image sender program results in a
file download, not an image being displayed..well I haven;t go time to
delve into either if those issues right now, so they stand..
Sep 18 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ralph Freshour | last post by:
My .php app displays an image on the web page, I notice that different ..jpg images display "funny" - apparently they all have slightly different image widths and heights yet in the image tag I...
5
by: Alper Adatoz | last post by:
Hi, i have a little problem. i hope u guys give me a clear solution (: db: mssql i just want to put jpeg file to the image field at the mssql db. and after that i want to call it back..
1
by: Dave Posh | last post by:
I seem to be having a problem displaying time stored in mysql. The format stored in the database is 13:15:05. The database data type is time. I'm using asp vbscript and sql to retrieve the time...
0
by: Matt | last post by:
Hi I'm have difficulty displaying images that are stored in a MySQL database. I've tried using the odbc.net provider, the ByteFX provider and the MySQLDriverCS one but can't seem to get the...
2
by: Jeronimo Bertran | last post by:
Hello, I am using a rendering aspx page to display a database image on an Image control. When the database record is retrieved, I am saving the bitmap to a session variable for the rendering...
2
by: Just Me | last post by:
Hi, Im playing with this concept at the moment and was hoping to design an image retreival system which would allow me to place images into the web page " Where I want them", but draw them from...
0
by: suprodeep | last post by:
have a page for admin(admin.aspx). This would enter product name, image, category name and and long description in a formatted manner. The prod name, image, category name can be inputted to...
14
ddtpmyra
by: ddtpmyra | last post by:
Hi below is my script displaying all the information inside the table. Pupose: pupose of this php page is to display all the information on my table and have a check box at the last column that...
6
by: Jeff | last post by:
hi asp.net 2.0 I have a image (.jpeg) stored in sql server 2005 and now I want to display it on a webpage. So I created a webpage (Image.aspx) which just writes the buffer data to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.