Arbitrary image resizing in PHP
<p>What would be the best way to resize images, which could be of any dimension, to a fixed size, or at least to fit within a fixed size?</p>

<p>The images come from random urls that are not in my control, and I must ensure the images do not go out of an area roughly 250px x 300px, or 20% by 50% of a layer.</p>

<p>I would think that I would first determine the size, and if it fell outside the range, resize by a factor, but I am unsure how to work out the logic to resize if the image size could be anything.</p>

<p>edit:I do not have local access to the image, and the image url is in a variable with is output with img src=..., I need a way to specify the values of width and height tags.</p>
