Dynamically set width and height of image with PHP and the such
<p>So - I have this website (<a href="http://pickture.me" rel="nofollow">Pickture</a>) which allows users to upload a photo of virtually any size.
This causes a headache when it comes to displaying them.
<br /><br />
Currently this happens. The Image is inside a container DIV (which I would prefer to be untouched), and is set to a width of 100% and the height is left blank. This means that all images, even if only 200x200, will be scaled to be around 600x600.
<br /><br />
What I would like to happen is this. If the width of the image is greater than 650px, set the width to 100%. If the width is less than that, set the width of the image to be the width of the image (actual size).
<br /><br />
I was thinking I could probably do this with a combination of jQuery and PHP - PHP to get the dimensions of the image, and jQuery to set the display dimensions based on some variables put in with PHP - eg:</p>

<pre><code>&lt;script type="text/javascript"&gt;
     var imageWidth = &lt;?php echo 'something';?&gt;
     if (imageWidth &gt; 650) {
          $('#image').css('width', '100%');
     } else {
          $('#image').css('width', '&lt;?php echo 'something';?&gt;');
     }
&lt;/script&gt;
</code></pre>

<p>Thanks to anyone who can help me solve this conundrum.</p>
