pramanadiputra
11 months ago

Uploading Images scenario

Posted 11 months ago by pramanadiputra

Hi, I have a question.

Suppose I have a site such as Craiglist, where User can post an Ad, let say about Hotel? When user post their Hotel, on the Hotel detail page there are images listed in slideshow, images number could be variant, depends on how many images being uploaded by the User. what is the scenario for saving user uploaded images in this case?

Scenario 1. We have Posts table, and Post_Images table. For any uploaded images, we stored them on Post_Images table, so the Posts table hasMany() Post_Images table. When we want to display the images on the slideshow just call Post->postimages.

Scenario 2. We only have Posts table, but inside this table we defined n colums for images, let say 5. So we have column image1, image2, image3, image4, and so on. But with this scenario 2, the amount of images can be uploaded is already defined.

Scenario 3. Maybe you have Scenario 3?

Thank You

Please sign in or create an account to participate in this conversation.