0
Besvaret
Refresh idle timer for image deletion in PHP
To prevent auto image deletion by imgur, would a simple PHP code like:
fclose(fopen("http://i.imgur.com/xxxxx.jpg"))
be enough to reset the "idle timer"? My freecycling website uses your API, and if users renew listings (each 60 days) I would also like to refresh images... if listings expire (no renewal after 60 days) or users ask for deletion, I always call the deletion URL of pictures with this method, so I just want to make sure images stay on imgur as long as listings are on my website :)
fclose(fopen("http://i.imgur.com/xxxxx.jpg"))
be enough to reset the "idle timer"? My freecycling website uses your API, and if users renew listings (each 60 days) I would also like to refresh images... if listings expire (no renewal after 60 days) or users ask for deletion, I always call the deletion URL of pictures with this method, so I just want to make sure images stay on imgur as long as listings are on my website :)
Svar
0
Svar
Besvaret
Alan Schaaf (Founder) 14 år siden
Yep, that will work. However, you could also use cURL and grab only the headers. This would be much faster because you wouldn't have to wait for PHP to grab the whole file.
Svar
Besvaret
Yep, that will work. However, you could also use cURL and grab only the headers. This would be much faster because you wouldn't have to wait for PHP to grab the whole file.
I actually timed the fclose(fopen()) procedure, and I get from 0.2s to 1s regardless of the remote file (Tested on some 13MB wikimedia picture :D), so I suppose I am not getting the whole file anyway.
But to be on the safe side, to reduce the php exution time I'll test if cURL terminates faster.
But to be on the safe side, to reduce the php exution time I'll test if cURL terminates faster.
thanks for the pointer! curl needs the longest code to execute, and that's the reason I wasn't using it... but surprisingly enough it can be up to 5 times faster than both flocse(fopen()) and get_headers() (~0.07 seconds instead of up to 0.32seconds)
Kundesupport af UserEcho