Home  >  Article  >  Database  >  php利用GD库生成缩略图示例_MySQL

php利用GD库生成缩略图示例_MySQL

PHP中文网
PHP中文网Original
2016-05-27 14:12:05856browse

php利用GD库生成缩略图。 

$h){ 
$width=300; 
$height=$width/$w*$h; 
}else if($w<$h){ 
$height=300; 
$width=$height/$h*$w; 
}else{ 
$width=300; 
$height=300; 
} 
//创建空白新图片 
$newimage=imagecreatetruecolor($width, $height); 
//copy源图片内容 copy新图片 
imagecopyresized($newimage, $image, 0,0, 0,0, $width, $height, $w, $h); 
$filename="upload/s_".$file; 
imagejpeg($newimage,$filename);

以上就是php利用GD库生成缩略图示例_MySQL的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn