求PHP上传图片即时显示并将图片裁剪到指定大小的代码? 在上传图片时,如何将上传图片即时显示并将图片裁剪到指定大小? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php// File and new size$filename = 'test.jpg';$percent = 0.5;// Content typeheader('Content-type: image/jpeg');// Get new sizeslist($width, $height) = getimagesize($filename);$newwidth = $width * $percent;//设定大小$newheight = $height * $percent;// Load$thumb = imagecreatetruecolor($newwidth, $newheight);$source = imagecreatefromjpeg($filename);// Resizeimagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);// Outputimagejpeg($thumb);?> $newwidth $newheight 把这个设置一下就是裁剪了 求助PHP中使用session写一个类 高手来啊 问一个mysql_fetch_array的问题 媒体播放器防下载 熟悉PA的请进,帮我修改一个模块! 请问php能不能存入error.log进行调试呢? foreach问题 数据表里有多条符合条件的记录 怎么样写foreach才能一条条的换行显示出来?谢谢! 我用delphi写了一个小www服务器,想支持PHP 实在想...想不出来,请大家指点!关于PHP! php 如何把获取的数据以不同的样式显示 请做过国外paypal支付接口的朋友进来一下 php网页可以制作安全控件的吗???
// File and new size
$filename = 'test.jpg';
$percent = 0.5;// Content type
header('Content-type: image/jpeg');// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;//设定大小
$newheight = $height * $percent;// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);// Output
imagejpeg($thumb);
?>