$swf = 'flash.swf';
list($width, $height) = getimagesize($swf);
$demandedSize = 640;
$factor = $height / $width;
if($factor >= 1)
{
if($height != $demandedSize)
$width = round($demandedSize / $factor);
$height = $demandedSize;
}
else
{
if($width != $demandedSize)
$height = round($demandedSize * $factor);
$width = $demandedSize;
}