脚本宝典收集整理的这篇文章主要介绍了php – 从远程源下载图像并调整大小然后保存,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
所以基本上我会在“http://www.sITe.COM/image.jpg”上保存一个像120×120像素的网页服务器“/images/myChosenName.jpg”.
谢谢
<?PHP $img = file_get_contents('http://www.site.com/image.jpg'); $im = imagecreatefromstring($img); $width = imagesx($im); $height = imagesy($im); $newwidth = '120'; $newheight = '120'; $thumb = imagecreatetruecolor($newwidth,$newheight); imagecopyresized($thumb,$im,$newwidth,$newheight,$width,$height); imagejPEg($thumb,'/images/myChosenName.jpg'); //save image as jpg imagedestroy($thumb); imagedestroy($im); ?>
以上是脚本宝典为你收集整理的php – 从远程源下载图像并调整大小然后保存全部内容,希望文章能够帮你解决php – 从远程源下载图像并调整大小然后保存所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。