Thank you! I haven't used your code specifically, but it was exactly what I needed to know.
Because this is going in a user profile field, I haven't needed to specifically write php code for it, instead I used the preg_match feature of the user profile field. Below is the characters I am currently allowing, I have added 0-9, ~, _ and - and allowed for a blank entry.
PHP Code:
^http://([A-Za-z0-9/.~_-]+)\.(jpg|gif|png)$|^$
It now supports the ability to set the image dimensions between 20 and 120 pixels with the below regular expression on two other mandatory user profile fields.
PHP Code:
^([2-9][0-9]|11[0-9]|120)$