电脑安全

您当前的位置:主页 > 电脑安全 >

php 切取图片代码-网络编程

来源:[db:来源]标题:   代码    编辑:电脑技术全能网 时间:2019-09-20 12:29

原标题:php 切取图片代码-网络编程
   php 切取图片代码 function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale){list($imagewidth, $imageheight, $imageType) = getimagesize($image);$imageType = image_type_to_mime_type($imageType);$newImageWidth = ceil($width * $scale);$newImageHeight = ceil($height * $scale);$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);switch($imageType) {case "image/gif":$source=imagecreatefromgif($image); break; case "image/pjpeg":case "image/jpeg":case "image/jpg":$source=imagecreatefromjpeg($image); break; case "image/png":case "image/x-png":$source=imagecreatefrompng($image); break; }imagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHeight,$width,$height);switch($imageType) {case "image/gif": imagegif($newImage,$thumb_image_name); break; case "image/pjpeg":case "image/jpeg":case "image/jpg": imagejpeg($newImage,$thumb_image_name,90); break;case "image/png":case "image/x-png":imagepng($newImage,$thumb_image_name); break; }chmod($thumb_image_name, 0777);return $thumb_image_name;}

上一篇:php把ubb代码转换成html-网络编程

下一篇:没有了