You have implemented a Cross Site Scripting (XSS) vulnerability. This type of injection vulnerability can be used by an attacker to steal the credentials of your users, or make users perform actions on your site or against other sites without their knowledge. For more information about XSS see wikipedia: http://en.wikipedia.org/wiki/Cross-site_scripting
So YES, you should validate your input. Match it against a regular expression using preg_match such as
You should also escape strings that are outputted to html using the htmlspecialchars function in php.
$src = htmlspecialchars($src, ENT_QUOTES);
echo "<img src='$src' />";