Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Scouting (http://www.chiefdelphi.com/forums/forumdisplay.php?f=36)
-   -   online scouting database + picture question (http://www.chiefdelphi.com/forums/showthread.php?t=26292)

Robert Hafner 02-03-2004 08:49

online scouting database + picture question
 
Just so you all know, there are currently 27 teams registered on the team 96 scouting database, so if any of you are looking to do some scouting I would suggest you check it out there (www.team96.org).


Now, for my question-
I'm using a MySQL database to run the scouting program, and I was wondering if it was possible to store pictured into the database. I know the blob type is for storing binary data, but how would I go about putting a picture in there, and then how would I have it display?

Brandon Martus 02-03-2004 09:17

Re: online scouting database + picture question
 
Quote:

Originally Posted by Robert Hafner
I'm using a MySQL database to run the scouting program, and I was wondering if it was possible to store pictured into the database. I know the blob type is for storing binary data, but how would I go about putting a picture in there, and then how would I have it display?

here's some snippets. nothing complete, but it'll get you on the right track, i think.

grab the file, first.
Code:

          @ob_start();
            $output = @readfile("/path/to/file.jpg"); // could be url
            $theImage = @ob_get_contents();
            @ob_end_clean();

and then run this insert
Code:

"INSERT INTO table (id,column) VALUES ('','".addslashes($theImage)."')"'
to display later, assuming its a jpeg:
Code:

@header('Content-Type: image/jpeg');
 // echo out contents of that column you just updated


steven114 02-03-2004 09:25

Re: online scouting database + picture question
 
Take the JPEG file, read it into a blob, and when you want to recreate it I believe PHP has some functions for doing so. If not, you could always create a temporary file and write the data back.


All times are GMT -5. The time now is 02:26.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi