picScale is a small PHP library to scale/resize images. Size of the image can be increased or decreased by keeping the aspect ratio of the image as it is.
This library is pretty simple in usage.
include_once("PicScale.php");
$input = "inputImage.png";
$output = "outputImage.png";
$resizeObj = new PicScale($input);
$resizeObj->resize($width = 200,$height = 300);
$resizeObj->output($output);
$input = "plant.jpg";
$output = "BlurredImagePadding.jpg";
$new = new PicScale($input);
$new->resize($width = 450, $height = 450);
$new->output($output);
Input Image:
Output Image:
$input = "plant.jpg";
$output = "WhiteSpacePadding.jpg";
$new = new PicScale($input);
$new->options("colorpadding", true);
$new->resize($width = 450, $height = 450);
$new->output($output);
Input Image:
Output Image:
If you want to put any color in the padding area
$new = new PicScale($input);
$new->options("colorpadding", true);
$new->resize($width = 600, $height = 450);
$new->options("paddingcolor", array(149,213,50));
$new->output($output);
Input Image:
Output Image:
$new = new PicScale($input);
$new->options("crop-image", true);
$new->resize($width = 600, $height = 450);
$new->output($output);
Input Image:
Output Image:
OR, if you want to specify the percentage of image that can be cropped else pad-image with any color/blur image.
$new = new PicScale($input);
$new->options("crop-percent", 50);
$new->resize($width = 600, $height = 450);
$new->output($output);