1
faceair 2013-12-11 11:33:00 +08:00 via Android
七牛可以
|
2
markmx 2013-12-11 11:36:53 +08:00
自己也可以是实现的。 你这样的话 就需要每次都要转格式了吧。。
|
3
manhere 2013-12-11 11:40:04 +08:00
|
4
akaayy OP |
5
akaayy OP |
6
akaayy OP @manhere 你收的这个功能很强大,挺不错,不过还要安装
我在我发的那个地址里找到了一个符合我要求的一段,很简洁的,可以直接使用 保存为utf-8编码的时候出错了,改为ansi就正常了 ----------------------------------------------------- Resize image proportionaly where you give a max width or max height <?php header('Content-type: image/jpeg'); //$myimage = resizeImage('filename', 'newwidthmax', 'newheightmax'); $myimage = resizeImage('test.jpg', '150', '120'); print $myimage; function resizeImage($filename, $newwidth, $newheight){ list($width, $height) = getimagesize($filename); if($width > $height && $newheight < $height){ $newheight = $height / ($width / $newwidth); } else if ($width < $height && $newwidth < $width) { $newwidth = $width / ($height / $newheight); } else { $newwidth = $width; $newheight = $height; } $thumb = imagecreatetruecolor($newwidth, $newheight); $source = imagecreatefromjpeg($filename); imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); return imagejpeg($thumb); } ?> ----------------------------------------------------- |