get filename with pure extension
<p>I'm coding a script to get image from a site. All is good, but then I notice there are some sites which have images in format like this:</p>

<pre><code>http://site-name/images/dude-i-m-batman.jpg?1414151413
http://site-name/images/dude-i-m-batman.jpg?w=300
</code></pre>

<p>right now I'm dealing with it by doing</p>

<pre><code>$file = substr($media,0, strrpos($image, '.') + 4);
</code></pre>

<p>I'm just wondering whether it's a good practice or there's a better way.</p>

<p>I've tried pathinfo and a couple other methods, but all return extension with the query string.</p>

<p>Thanks</p>
