TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Read picture dir and store pics to Mysql (http://www.talkphp.com/general/5424-read-picture-dir-store-pics-mysql.html)

Peuplarchie 05-24-2010 09:55 PM

Read picture dir and store pics to Mysql
 
Good day to you all,
I was looking into makeing a database of all my image and I was wondering if there is a way to read a recursive directory and store it into the database.

I don't have a clue on how, even if I have search the web for a while.


Thanks, take care and have a good one !

Village Idiot 05-25-2010 12:47 AM

Quote:

Originally Posted by Peuplarchie (Post 30521)
Good day to you all,
I was looking into makeing a database of all my image and I was wondering if there is a way to read a recursive directory and store it into the database.

I don't have a clue on how, even if I have search the web for a while.


Thanks, take care and have a good one !

You would have to do it via PHP. There should be tons of scripts with the ability to list files out there, just use fstream to get the content and store it.

Out of interest, why are you storing files in the database? Databases really are not meant for that sort of thing.

Peuplarchie 05-25-2010 02:20 AM

I red a please that said it was doable so I just assume we add to do this for faster loading.

Should I just put le url of the image in the db ?

How would I do this ?

Village Idiot 05-25-2010 06:13 AM

Quote:

Originally Posted by Peuplarchie (Post 30524)
I red a please that said it was doable so I just assume we add to do this for faster loading.

Should I just put le url of the image in the db ?

How would I do this ?

It's doable, but the filesystem is far faster.

I would just store the URL in the database. That is as simple as an insert statement in a varchar field.

nefus 05-25-2010 02:09 PM

I've done something similar in the past but my code was lost lost. *sigh* I stored the filename and url in sql. There are plenty of examples online that you can update to your needs.

sketchMedia 05-26-2010 10:14 AM

Quote:

Originally Posted by Village Idiot (Post 30527)
It's doable, but the filesystem is far faster.

I would just store the URL in the database. That is as simple as an insert statement in a varchar field.

I agree, let the web server do what its good at and let mysql do what its good at.

If you insist on this method, look into the Mysql BLOB type.


All times are GMT. The time now is 07:39 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0