TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 05-24-2010, 09:55 PM   #1 (permalink)
The Acquainted
 
Peuplarchie's Avatar
 
Join Date: May 2008
Location: Québec
Posts: 104
Thanks: 10
Peuplarchie is on a distinguished road
Application 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 !
__________________
That's why we are not alone on earth... let's build !
Peuplarchie is offline  
Reply With Quote
Old 05-25-2010, 12:47 AM   #2 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by Peuplarchie View Post
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.
__________________

Village Idiot is offline  
Reply With Quote
Old 05-25-2010, 02:20 AM   #3 (permalink)
The Acquainted
 
Peuplarchie's Avatar
 
Join Date: May 2008
Location: Québec
Posts: 104
Thanks: 10
Peuplarchie is on a distinguished road
Default

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 ?
__________________
That's why we are not alone on earth... let's build !
Peuplarchie is offline  
Reply With Quote
Old 05-25-2010, 06:13 AM   #4 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by Peuplarchie View Post
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.
__________________

Village Idiot is offline  
Reply With Quote
Old 05-25-2010, 02:09 PM   #5 (permalink)
The Contributor
 
nefus's Avatar
 
Join Date: Nov 2007
Location: Nashville, TN
Posts: 66
Thanks: 20
nefus is on a distinguished road
Default

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.
__________________
I am not a programmer, nor do I play one on tv.
nefus is offline  
Reply With Quote
Old 05-26-2010, 10:14 AM   #6 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
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.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


All times are GMT. The time now is 04:30 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design