/    Sign up×
Community /Pin to ProfileBookmark

Dilemma: Images storage with PHP/MySQL

Hi,

I was wondering if anyone could suggest a solution to my problem:

I am working on creating a website that will feature the artwork of various artists. Each member can show up to 12 images on their page. Currently, member’s updates work in the following manner:

  • 1. Member will email me images.

  • 2. I will manually upload them to the server, delete the old images and adjust the HTML.
  • This is pretty inefficient as you can probably tell.

    I am working on using a MySQL database to help with my member updates. I’m new to this, and although, I’ve done some reading, I still do not have a clear idea of what I should do.

    Solution #1: Store the images in a database.
    -Everything I read states that this can be done but it is a very bad practice due to the database running slowly.

    I would rather not have a slow loading site, but this option would make it very easy to limit the total images per member to 12.

    Soultion #2: Upload images into a directory and store paths in database.

    -The reason that this isn’t an ideal solution is this situation:

    Member has 12 images in their folder.
    Member uploads 4 new images.
    Total images in folder = 16.

    I need for each member to only have 12 images stored at once.

    Please, if know of a solution to this, let me know. This is the largest stumbling block that I’ve come across yet.

    Thank you,
    Mike

    to post a comment
    PHP

    5 Comments(s)

    Copy linkTweet thisAlerts:
    @george1234Jan 28.2005 — Should be able to implement solution 2. Just remove the oldest file when they start uploading files after file #12. You could also name the files on the disk accordingly based on their order of upload.

    Usually in PHP, you allow uploads to a temporary folder first, and then copy the file over to a permenant storage location. So if you do this, you can let it upload, but DONT copy the file over if they already have 12. Or delete the oldest one first before copying the new one over.

    George.
    Copy linkTweet thisAlerts:
    @NogDogJan 28.2005 — You could create a 1-stop maintenance form.

    For each photo they already have on the site, display a row of info (and maybe a thumbnail?) with a "Delete Photo" button. Keep a count of how many are displayed, and if count < 12, display an upload form. If count >= 12 display a message that they have the maximum number allowed and must delete a photo if they wish to upload a new one.
    Copy linkTweet thisAlerts:
    @Wart_HogauthorFeb 04.2005 — George & Nog Dog,

    Thanks for the suggestions.

    I have made a page that will display each member's currently uploaded images (as thumbs) with an "update" link right next to it. When the user clicks the link, they are directed to a page where they can upload a new image in it's place. When they choose a file and click submit, the script will first delete the old image and then process the upload.

    What do you think about this method?

    Can anyone point me in the direction of a resource that gives examples of different ways of laying out a database? I looked online and the only ones that I could find were a very abstract.

    Thanks again!!!

    Mike
    Copy linkTweet thisAlerts:
    @NogDogFeb 04.2005 — Sounds like a reasonable approach to me.

    As far as DB design, there's an easy-to-read article here: http://www.geekgirls.com/databases_from_scratch_2.htm (besides, you've got to check out a site with a domain name like that ? )
    Copy linkTweet thisAlerts:
    @Wart_HogauthorFeb 05.2005 — Nog Dog,

    Thanks for the link... much better than what I found.

    -Mike
    ×

    Success!

    Help @Wart_Hog spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.14,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...