Newbie Question - Storing Images
Moderator: General Moderators
-
ScotlandOnLine
- Forum Newbie
- Posts: 5
- Joined: Sat Mar 15, 2003 4:57 pm
Newbie Question - Storing Images
Hi Forum -
Just a quickie question - has any body got any code that they wish to share with me that will allow images to be stored in Mysql Database ?
What type of database object is required to store images and which PHP functions can be used to store/retrieve such?
Thank s in advance for your help !
Just a quickie question - has any body got any code that they wish to share with me that will allow images to be stored in Mysql Database ?
What type of database object is required to store images and which PHP functions can be used to store/retrieve such?
Thank s in advance for your help !
-
ScotlandOnLine
- Forum Newbie
- Posts: 5
- Joined: Sat Mar 15, 2003 4:57 pm
-
ScotlandOnLine
- Forum Newbie
- Posts: 5
- Joined: Sat Mar 15, 2003 4:57 pm
>>Jim
so how do I code the transfer of the image from the users browser to get it on to my disks .... without letting the user see the other content (images) in the target directory .....I guess the file upload function is out!
and then dynamically embed the image from the path if it needs to be displayed
... I see
...I think....
and then dynamically embed the image from the path if it needs to be displayed
... I see
...I think....
- daven
- Forum Contributor
- Posts: 332
- Joined: Tue Dec 17, 2002 1:29 pm
- Location: Gaithersburg, MD
- Contact:
viewtopic.php?t=6435
Page with lots of stuff about file uploading scripts.
Hmm...note to self: ask Jason if he is willing to make a sticky about file uploading, since we seem to get a lot of questions about it.
And Scotland: You get major points for knowing that "benthic riparian algal feeder" means bottom dwelling scum sucker. *grin* I get lots of questions about it.
Related note: my name is Daven, not Dave. I know way too many people named dave to permit myself to be referred to as one. Cheers. (yes, I have been at work WAY too long today)
Page with lots of stuff about file uploading scripts.
Hmm...note to self: ask Jason if he is willing to make a sticky about file uploading, since we seem to get a lot of questions about it.
And Scotland: You get major points for knowing that "benthic riparian algal feeder" means bottom dwelling scum sucker. *grin* I get lots of questions about it.
Related note: my name is Daven, not Dave. I know way too many people named dave to permit myself to be referred to as one. Cheers. (yes, I have been at work WAY too long today)
-
ScotlandOnLine
- Forum Newbie
- Posts: 5
- Joined: Sat Mar 15, 2003 4:57 pm
Daven
Many apologies for the name mistake - read and digested !
as for reference the benthic riparian algal feeder - I guess you get called far worse *wink*
Thanks for the link though - very useful!
as for reference the benthic riparian algal feeder - I guess you get called far worse *wink*
Thanks for the link though - very useful!
-
fractalvibes
- Forum Contributor
- Posts: 335
- Joined: Thu Sep 26, 2002 6:14 pm
- Location: Waco, Texas
A caveat to all the above, I think - It Depends. If you are uploading images that only 1 app will use - store the link to the image, not the image in the database. I have some situations where applications on different servers (Internet vs Intranet) need access to these photos. As the two sites cannot see each other's file systems, they can see the same database, therefore that is where the images reside. If the database is well-tuned and you can access the image by a unique primary key - say, employee number - performance is very good. A BLOB column can store anything from a jpeg to an MP3 file, so you could create a universal media
serving app very easily - just save the mime type along with the blob and you can serve up any media!
But, if it is a simple app - do as the others wisely say.
My 1/2 cent...
Phil J.
serving app very easily - just save the mime type along with the blob and you can serve up any media!
But, if it is a simple app - do as the others wisely say.
My 1/2 cent...
Phil J.
What I would theoretically do is:
1) First, md5(PICTURE_FILENAME), for fun.
2) Copy the name of that, store it inside a database.
3) When viewing the picture, call the picture name from the database, and it should give you the correct picture.
(note: md5 isn't needed at all, but I seem to think that having all file names the same length tends to be more neat :/)
1) First, md5(PICTURE_FILENAME), for fun.
2) Copy the name of that, store it inside a database.
3) When viewing the picture, call the picture name from the database, and it should give you the correct picture.
(note: md5 isn't needed at all, but I seem to think that having all file names the same length tends to be more neat :/)
