Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 789349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:30:38+00:00 2026-05-14T21:30:38+00:00

I am using php and mysql. If I want to do a sharing photos

  • 0

I am using php and mysql. If I want to do a sharing photos website, whats the best database design for upload and display photos. This is what I have in mind:

domain:
  |_> photos
  |_> user

Logged in user will upload photo in
[http://www.domain.com/user/upload.php%5D

The photos are stored in filesystems, and the path-to-photos stored in database. So, in my photos folder would be like: photos/userA/subfolders+photos, photos/userB/subfolders+photos, photos/userC/subfolders+photos etc

Public/others people may view his photo in:
[http://www.domain.com/photos/user/?photoid=123%5D

where 123 is the photoid, from there, I will query from database to fetch the path and display the image.

My questions:

  1. Whats the best database design for photo-sharing website (like flickr)?

  2. Will there be any problems if I keep creating new folder in “photos” folder. What if hundreds of thousands users registered? Whats the best practices

  3. What size of photos should I keep? Currently I only stored thumbnail (100×100) and (max) 1600×1200 px photos.

  4. What others things I should take note when developing photos-sharing website?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:30:39+00:00Added an answer on May 14, 2026 at 9:30 pm

    1 – At a minimum your database should consist of

    users: user_id, user_name, pw_hash, salt
    photos: photo_id, user_id, photo_path
    

    fields would be added for extra functionality you wanted (tags, last_seen, photo_upload_date, photo_views, etc…)

    2 – Dont prematurely optimize. i would go with adding a users/username folder for each user and dumping the users photos in there.

    3 – i recommend keeping the original size, thumbnail, and a size that is suited for your site. so if your layout holds a photo with max width of 850px resize all photos to a max 850px wide. If youre layout changes you can use the original picture and resize them to the new size.

    4 – there is an excellent answer on SO somewhere about image upload security but i cant find it. ill keep looking.

    think about using a CDN: https://stackoverflow.com/questions/72369/whats-the-best-cdn-for-image-hosting-on-a-high-volume-web-site

    good talk on scalabilty, the section on thumbnails would be good for you to watch: http://www.youtube.com/watch?v=ZW5_eEKEC28. this video talks about a file-per-directory limit in ext3 filesystems you may be interested in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to run a web application on php and mysql, using the CakePHP
Using PHP and MySQL, I have a forum system I'm trying to build. What
I'm building a wepage in php using MySQL as my database. Which way is
I am using MySQL and PHP for a project I am working. I have
Been using PHP/MySQL for a little while now, and I'm wondering if there are
I'm planning to make a very simple program using php and mySQL. The main
I am part of a team creating a web application using PHP and MySQL.
I am part of a team creating a web application using PHP and MySQL.
I am developing a PHP/MySQL application using vertrigoserver. I need to enter the German
I've been using PHP & MySQL for ages and am about to start using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.