php打造缩略图图片

WBOY
Release: 2016-06-13 10:41:11
Original
791 people have browsed it

php制作缩略图图片

<?phpif (! isset ( $_POST ["submit"] )) {	echo "<?xml version=\"1.0\" encoding=\"UTF-8\"";} else {	if (isset ( $_FILES ["file"] ) || $_POST ["file"] != "") {		function resizeimage($file, $rate = .5) {			$size = getimagesize ( $file );			switch ($size [2]) {				case 1 :					$img = imagecreatefromgif ( $file );					break;				case 2 :					$img = imagecreatefromjpeg ( $file );					break;				case 3 :					$img = imagecreatefrompng ( $file );					break;			}			$srcw = imagesx ( $img );			$srch = imagesy ( $img );			$detw = floor ( $srcw * $rate );			$deth = floor ( $srch * $rate );			$im = imagecreatetruecolor ( $detw, $deth );			$black = imagecolorallocate ( $im, 255, 255, 255 );			imagefilledrectangle ( $im, 0, 0, $detw, $deth, $black );			imagecopyresized ( $im, $img, 0, 0, 0, 0, $detw, $deth, $srcw, $srch );			header ( 'Content-type:image/png' );			imagepng ( $im );			imagedestroy ( $im );			imagedestroy ( $img );		}		resizeimage ( $_FILES ["file"] ["tmp_name"] );	}}?><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title><style type="text/css">td {	margin: 0;}</style><script type="text/javascript">function submit(){	obj=document.form1.submit();	return obj;}</script>
Copy after login
">
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template