This is an example of get high resolution images.
* Class name : resizeImage
* Created by : wang
* Description : This class is to resize the image from original size to new size
*/classresizeImage{/**
* Function name : resize_img
* Description : This function is to resize image
* @param : $origimg variable is the original image
* @param : $newimg variable is the new image
* @param : $w variable is the width of image
* @param : $f variable is the height of image
*/public functionresize_img($origimg,$newimg,$w,$h){$info=getimagesize($origimg);$mime=$info['mime'];// Make sure that the requested file is actually an imageif(substr($mime,0,6) !='image/')
{header('HTTP/1.1 400 Bad Request');
return'Error: requested file is not an accepted type: '.$origimg;
exit();
}// Check they extention of image$extension=image_type_to_extension($info[2]);
if(strtolower($extension) =='.png'){$img=$this->resize_imagepng($origimg,$w,$h);imagepng($img,$newimg);imagedestroy($img);
}elseif(strtolower($extension) =='.jpeg'){$img=$this->resize_imagejpeg($origimg,$w,$h);imagejpeg($img,$newimg);imagedestroy($img);
}elseif(strtolower($extension=='.gif')){$img=$this->resize_imagegif($origimg,$w,$h);imagegif($img,$newimg);imagedestroy($img);
}
}/**
* End function name : resize_img
*/
/**
* Function name : resize_imagepng
* Description : This function is to resize png image
* @param : $file variable is the original image
* @param : $w variable is the width of image
* @param : $f variable is the height of image
*/private functionresize_imagepng($file,$w,$h) {
list($width,$height) =getimagesize($file);$src=imagecreatefrompng($file);$dst=imagecreatetruecolor($w,$h);imagecopyresampled($dst,$src,0,0,0,0,$w,$h,$width,$height);
return$dst;
}/**
* End function name : resize_imagepng
*/
/**
* Function name : resize_imagejpeg
* Description : This function is to resize jpeg image
* @param : $file variable is the original image
* @param : $w variable is the width of image
* @param : $f variable is the height of image
*/private functionresize_imagejpeg($file,$w,$h) {
list($width,$height) =getimagesize($file);$src=imagecreatefromjpeg($file);$dst=imagecreatetruecolor($w,$h);imagecopyresampled($dst,$src,0,0,0,0,$w,$h,$width,$height);
return$dst;
}/**
* End function name : resize_imagejpeg
*/
/**
* Function name : resize_imagegif
* Description : This function is to resize gif image
* @param : $file variable is the original image
* @param : $w variable is the width of image
* @param : $f variable is the height of image
*/private functionresize_imagegif($file,$w,$h) {
list($width,$height) =getimagesize($file);$src=imagecreatefromgif($file);$dst=imagecreatetruecolor($w,$h);imagecopyresampled($dst,$src,0,0,0,0,$w,$h,$width,$height);
return$dst;
}/**
* End function name : resize_imagegif
*/}/**
* End class name : resizeImage
*/?>