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?

Recommended Answers

All 6 Replies

Member Avatar for diafol

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.

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?

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 for diafol

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.

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 for diafol

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.