Added a timeout option
Immediately returning when the extension of the file is not supported.
Little more robust PhantomJS script.