Jump to content

Handle many files linked to database entry in php


Ortix

Recommended Posts

I'm writing a small applications with episodes which contain 10-15 screenshots with each screenshot having 5 different resolutions. Every week there are about 20 new episodes. You can imagine that every week I have a lot of screenshots which have to be somehow linked to their respective episode.

 

Currently the filenames are stored in a MySQL database, but after 5 minutes of testing I already have 100+ rows. Not quite sure if that's a smart way of moving forward. The advantage of having them in the DB is that I can easily grab them using Eloquent ORM without having to finnick around with regeneration of filenames for on the fly loading.

 

Are there any good other alternatives of linking multiple files to database entries? Or should I just stick with the current method? What would be some adverse effects of doing it this way?

 

The way you are doing it is the best way, saving image locations in a database.

 

As for different resolutions you can use GD and do it on the fly and only keep one better quality sized image.

You could even cache the generated images.

 

A relational database is probably best here, one table would hold your episodes and going by id can link another table with all it's screenshots

 

If posted your database layout and how you query them someone may be able to help further with what you have.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.