php生成图片缩略图显示在页面上 生成的缩略图不仅尺寸小,文件也要小,怎么弄啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参考手册上的例子$filename = 'Desert.jpg';$percent = 0.5;// Content typeheader('Content-Type: image/jpeg');// Get new dimensionslist($width, $height) = getimagesize($filename);$new_width = $width * $percent;$new_height = $height * $percent;// Resample$image_p = imagecreatetruecolor($new_width, $new_height);$image = imagecreatefromjpeg($filename);imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);// Outputimagejpeg($image_p, null, 100); 求phpchina的邀请码@@@!!!! PHP有没有好的IDE、调试器?写它真麻烦,又没有自动关键字,又没有出错调试,那里错也不知道。请大家推荐工具! 求助,如何用php读取 内容中的特定对象 在线等 从PHP官方网站下载的PHP手册CHM版的为什么会乱码?怎么解决? php中的mail函数问题 有办法处理提交的html表格么 为什么PHP生成的图片不能正常显示 怎么取得本页的url?带参数的。 !!!急救!!!如何控制输出的字符宽度??? 有没有人能告诉我GD库怎么安装????(40分) php+ajax里php怎么取ajax传递过来的值 safeVar() 是什么意思啊?
$filename = 'Desert.jpg';
$percent = 0.5;// Content type
header('Content-Type: image/jpeg');// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);// Output
imagejpeg($image_p, null, 100);