To auto-resize images (an example to autoresize to a maximum width or height of 100, the image proportions will be kept)
Also, this code will save all images as "./images/mini.jpg", you need to change that to the specified location & filename:
$width = 100;
$height = 100;
$source = imagecreatefromjpeg($url);
list($width_orig, $height_orig) = getimagesize($uploadfile);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
$miniImg = imagecreatetruecolor($width, $height);
imagecopyresampled($miniImg, $source, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($miniImg, "./images/mini.jpg", 100);
Hope this helps