Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4048

What metadata should I track in my database to keep track of my images stored in s3

$
0
0

I am taking over a website that is about 20years old. The website has hundreds of thousands of images in folders right on the web server taking u close to 100gigs. The folder structure is quite hierarchical and I'd rather not modify it too much. The database design isn't great and currently, to display an image there's simple php code that simply concatenates the various folder metadata and the file name to display a file. ex https://website/country/county/cemetery/filename.

The above has become extremely messy and there are many broken links because typos are constantly being corrected (thereby changing the path), files moved to different folders, etc.

I was hoping to leverage AWS S3 for a few reasons though this is my first time trying it. The API is very easy to work with, I already have about a dozen endpoints working such as Creating new Folders, renaming files, etc.

My question came about as I realized there doesn't seem to be a Unique ID as part of the Folder metadata in S3. The Object Key, which all the documentation says to use to identify an object can actually change with any object modification.

I think I might have a way forward becuase I know some of the issues the clients are facing. In part, the database and the folder contents seem to be out of sync. Meaning files have been uploaded or deleted without this being updated in the database.

I was thinking that I would create a new MS SQL database (becuase this is what I am familiar with) and the front end will be in Blazor. I thought I could store the Unique Database column Ids as Tags in S3.

If my Image Table has a column for Country FK and Cemetery FK then I could store these in the S3 Tags collection.

This way, I could Query the DB for all Images in Cemetery ID AND Query the API for all Tags that equal Cemetery ID and this should allow me to spot any anomalies. Also, I ought to be able to then more easily maintain the Tags of objects whenever something is modified by querying for the old value and updating for the new value.

This should also then allow me to visualize the images when using the GetPreSignedUrl function by string interpolation from the Tags ex

var objectKey = $"bucket/Country/{CountryTag}/{CemeteryTag}/{Filename}"

The overall question is is there a better way to do this or am I just discovering something everyone already knows?

Thanx for your ideas.


Viewing all articles
Browse latest Browse all 4048

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>