I am using SmartFile to store user submitted files. To display image files on the site I could just link to them, but if the file is missing I have no option to display a default image instead. Or to prevent hot linking. Or to setup browser cache etc.
Their API is throttled to 180 requests per min. So it’s no good for displaying images on a busy site.
I have tried using get_headers
to check the expected file exists and then file_get_contents
, if it does, but that is very slow and inefficient. Just using file_get_contents
with out get_headers
first is very slow!
What’s my best option here? I haven’t tried using curl
yet. I think I could get headers and file with just one request with that, but as file_get_contents
is slow, I imagine curl won't be any faster.