PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Displaying an image from inside Mysql database..
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Displaying an image from inside Mysql database..

Réponse
 
LinkBack Outils de la discussion
Vieux 14/09/2007, 11h55   #1
The Natural Philosopher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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?
  Réponse avec citation
Vieux 14/09/2007, 12h09   #2
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Displaying an image from inside Mysql database..

On 14 Sep, 11:55, The Natural Philosopher <a...@b.c> wrote:
> 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.

  Réponse avec citation
Vieux 14/09/2007, 12h17   #3
The Natural Philosopher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Displaying an image from inside Mysql database..

Captain Paralytic wrote:
> On 14 Sep, 11:55, The Natural Philosopher <a...@b.c> wrote:
>> 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.
  Réponse avec citation
Vieux 14/09/2007, 14h06   #4
Michael Fesser
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Displaying an image from inside Mysql database..

..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
  Réponse avec citation
Vieux 14/09/2007, 15h00   #5
The Natural Philosopher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Displaying an image from inside Mysql database..

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.
  Réponse avec citation
Vieux 14/09/2007, 16h24   #6
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Displaying an image from inside Mysql database..

On 14 Sep, 15:00, The Natural Philosopher <a...@b.c> wrote:
> 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

  Réponse avec citation
Vieux 15/09/2007, 12h53   #7
The Natural Philosopher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Displaying an image from inside Mysql database..

Captain Paralytic wrote:
> On 14 Sep, 15:00, The Natural Philosopher <a...@b.c> wrote:
>> 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..


  Réponse avec citation
Vieux 15/09/2007, 16h01   #8
The Natural Philosopher
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Displaying an image from inside Mysql database..

The Natural Philosopher wrote:
> Captain Paralytic wrote:
>> On 14 Sep, 15:00, The Natural Philosopher <a...@b.c> wrote:
>>> 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..
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 20h20.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12402 seconds with 16 queries