With this simple patch you can keep the image’s proportions after uploading.
In the snippet call you don’t tell the exact parameters of the userimage, but the maximum width and maximum height for it.
Using the &userImage=`500000,150,150` parameter, the snippet fits the image in these limits. If the picture is a portrait, it’s height will be 150px and the width will be less. If your image’s dimensions are both less than 150px, it remaines untouched.
In webloginpe.class.php find this:
// Get dimensions and set new ones.
list($width, $height) = getimagesize($userImage);
$new_width = $imageAttributes[1];
$new_height = $imageAttributes[2];
// Resample
After it paste this:
$xpercent = $new_width / $width;
$ypercent = $new_height / $height;
if ($xpercent < 1 || $ypercent < 1) {
if ($xpercent < $ypercent) $new_height = $height * $xpercent;
else $new_width = $width * $ypercent;
}
else { $new_width = $width; $new_height = $height; }
That’s it.
Of course in your templates you can’t have width and height stuff in the <img> tags!