Answer the question
In order to leave comments, you need to log in
How do you cache images for the web?
Actually, that's the question, now I cut them with php
and put them under a unique hash in the database.
And then I check if there is a hash and if there is, then I get the path to the already cut picture or I cut it and put it in the database, returning the same path.
However, in the database it turns out to be too expensive ... suggest an alternative
How to do it right?
Answer the question
In order to leave comments, you need to log in
I don't know what is meant by the uniqueness of the hash, but personally I bind the uniqueness to the picture itself, making md5 from the contents of the file. a lot of problems are immediately solved - with duplication of content, and with duplication of names, and with a uniform distribution over the directory hierarchy.
In this case, the database is really not needed to maintain uniqueness, but you still have to write to link images to entities.
I just don't understand what caching has to do with it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question