2016-12-25 15 views
1

我目前使用的是phpfox neutron pro(V4.5)软件,我遇到了上传图片/照片的问题。在phpfox中自动缩小图像的大小

每当我上传图片时,软件不会缩小图片的大小,它会按照原样上传图片。假设你正在上传1GB大小的图片,phpfox允许它以该大小上传。

有没有办法让软件在上传过程中减少或压缩图像,这个功能可以在Facebook.com上观察到。

问候

回答

2

PHPfox支持此功能:

用户>>管理用户组。选择所需的默认用户组。对于注册用户>>管理用户设置>>照片。

更改大小。

,但如果你想改变它编程在PHP中使用调整大小图片的功能:

$img = resize_image(‘/path/to/some/image.jpg’, 200, 200); 
+0

随着指出:

function resize_image($file, $w, $h, $crop=FALSE) { list($width, $height) = getimagesize($file); $r = $width/$height; if ($crop) { if ($width > $height) { $width = ceil($width-($width*abs($r-$w/$h))); } else { $height = ceil($height-($height*abs($r-$w/$h))); } $newwidth = $w; $newheight = $h; } else { if ($w/$h > $r) { $newwidth = $h*$r; $newheight = $h; } else { $newheight = $w/$r; $newwidth = $w; } } $src = imagecreatefromjpeg($file); $dst = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($dst, $src, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); return $dst; } 

您可以通过在项目中添加该娄代码调用这个函数功能在PHPFox中,它限制用户上传到一定的图像大小限制,但不会在上传较大的文件时压缩图像 – George

+0

您可以将此函数添加到php fox文件上传器中,并在图像上传器中调用它。 – Ghorbanzadeh

+0

请在哪里可以找到文件中的文件上传 – George