Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » inserting pictures in a SQLdatabase
Closed Thread
Old 11-24-2005, 07:10 AM   #1 (permalink)
 
Newb Techie

Join Date: Aug 2005

Posts: 20

hargi22

Question inserting pictures in a SQLdatabase

I got a mysql database with a php search function that will seach it and display the results but i need it to display a picture
i have tryed using a blob to put the picture in but when it is displayed on the web page it comes up with loads of letters not the picture
what am i doing wrong
hargi22 is offline  
Old 11-24-2005, 09:46 AM   #2 (permalink)
 
Ultra Techie

Join Date: Jul 2005

Posts: 530

TheHeadFL

Send a message via AIM to TheHeadFL
Default

Assuming you are doing everything else right, you have to tell PHP to send the MIME type manually.

You need to use:
Code:
header("Content-type: image/jpeg");
Also, once you do that, you need to output the image with imagejpeg($img) where $img is your php image structure.
__________________
Desktop machine: 2 x Opteron 246, Asus K8N-DL, 2GB PC3200 ECC Reg., XFX GeForce 6600GT, 74gb WD Raptor, 2 x 19\" LCDs, Windows XP x64
Server machine: Intel P4 3.0GHz 2MB EM64T, ECS i865pe, 1GB PC3200, 36gb WD Raptor, Windows Server 2003
Laptop: Dell Inspiron 9100 (Intel P4 3.2GHz 1MB Prescott, i865pe, 512MB PC3200, Mobility Radeon 9700, DVD+R/DL Burner), Windows XP
Linux: P3 450Mhz, 386MB ram, Slackware 10.1 (Running mySQL/Apache)
TheHeadFL is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On