Removing "../" from src string to avoid directory traversal attacks. User should not be allowed to manipulate image outside image folder.
Fixed filemtime() file status cache using clearstatcache() and avoided unnecessary call to getimagesize().