imageResize (inline)

Can’t rely on the size of an uploaded image and don’t want to resize it?

This function takes the larger size of the width and height and applies a formula accordingly. Then gets the new value and applies the percentage, then rounds the value. It returns the new sizes in html image tag format so that you can plug this function inside an image tag.

This is so this script will work dynamically with any size image, although relies on the use of getimagesize.


Use:

$imagepath = "/images/etc/image.jpg";
$image = getimagesize($imagepath);
// For Testing
// echo "
".$imagepath]; // echo "
0 = ".$logo[0]; // echo "
1 = ".$logo[1]; // echo "
2 = ".$logo[2]; // echo "
3 = ".$logo[3];