1,105,371 Community Members

Image in mysql vs directory

Member Avatar
RazorRamon
Junior Poster in Training
79 posts since Sep 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hello I'm looking to allow users upload pictures onto my site and have it displayed and linked to their site.. This process is for Ad purposes. Ive looked into php mysql uploading images but ive ran into a lot of threads condemning the practice and suggesting saving the images to a directory(and have the path saved in mysql).

Ive never tried uploading, displaying, querying, or loading images from either so I would like to know the major differences.

Are querys that much slower vs loading from directory?

Is it possible to have users upload directly into a directory? is this safe?

If jquery was integrated with the image query would that speed up the response time?

Member Avatar
diafol
Where are my eyes?
12,977 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,848 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

If you have small and few images a db storage may work for you. However directoty path is easier. You can filter the upload types you allow. Javascript typicLly slows things rathwr than speeeds things up.

Member Avatar
RazorRamon
Junior Poster in Training
79 posts since Sep 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Well like i said they are for Ads. I'm planning on giving them expiration dates and delete them once they've expired. Another question somewhat off topic from this. once i delete the expired entries there will be number gaps in the "id" number sequence.

When I "INSERT" new entries will the new entries fill in those gaps? or be tacked on the end?

Member Avatar
blocblue
Practically a Posting Shark
828 posts since Jan 2008
Reputation Points: 238 [?]
Q&As Helped to Solve: 162 [?]
Skill Endorsements: 16 [?]
Featured
 
0
 

When defining your database table, typically the unique identifier is a numerical field, where the value automatically increments. MySQL will then keep a track of what the next id number should be based on those it has previously allocated.

Auto increment would not reallocate the same id value, unless you explicitly changed the tables internal counter.

Member Avatar
diafol
Where are my eyes?
12,977 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,848 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

Don't worry about autoincrement - as blocblue says, the DB will take care of this for you. As long as you've got a robust normalized DB structure, you should be fine.

WRT to expiry dates - if you search for adverts within a set date (e.g. not yet expired), you probably don't need to delete any info. This may be useful to move old ads and related records into archive tables. This way an AD client can search for previous entries and re-activate the AD without having to feed in all the same data again.

Member Avatar
RazorRamon
Junior Poster in Training
79 posts since Sep 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Would you suggest making a log in for ad clients? to remember all of their info? I'm fairly new to logins and image querys but would there be away around the logins?

Member Avatar
diafol
Where are my eyes?
12,977 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,848 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

Most certainly. But it has to be secure. If not it will cause you a monster headache and possible loss of faith or worse

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: