Customizing SMF > SMF Coding Discussion
[all versions] minor enhancement for url_image_size in Subs.php
Christian Land:
Nothing special, just replace
--- Code: --- // See if it returned a 404/403 or something.
if ($test != '4')
return @getimagesize($url);
--- End code ---
with
--- Code: --- // See if it returned an HTTP Status beginning with 4 or 5 (=error)
if (($test != '4') && ($test != '5'))
return @getimagesize($url);
--- End code ---
... i don't know how PHP handles the 3** http-status-codes, but it could probably be a good idea to check for them, too ...
[Unknown]:
How many times is the status code going to be 50x?
-[Unknown]
Oldiesmann:
There are really only 3 status codes you need to check for:
403 - Permission Denied
404 - File Not Found
500 - Internal Server Error
I can't really think of why you would get anything else while looking for an image unless there was a problem with the server the image was stored on...
[Unknown]:
I can't even think of why you would get a 500 :P. Those error codes are mainly used for overloaded servers and bad scripts...
-[Unknown]
Christian Land:
::) It doesn't matter if the 50* errors are happening often. It simply makes sense to handle errors that can be handled.
Navigation
[0] Message Index
[#] Next page
Go to full version