function resize($im, $dst_width, $dst_height)
{
$width = imagesx($im);
$height = imagesy($im);
$newImg = imagecreatetruecolor($dst_width, $dst_height);
$white = imagecolorallocate($newImg, 255, 255, 255);
imagefill($newImg,0,0,$white);
imagecopyresampled($newImg, $im, 0, 0, 0, 0, $dst_width, $dst_height, $width, $height);
return $newImg;
}
$image = ImageCreateFromJpeg($uploaded_file);
$tn = resize($image, $modwidth, $modheight);
imagejpeg($tn, $save_file_name,95);
See More PHP ExamplesHire Me For A Project
2024 © SofiaCoder.com