我正在调整项目中的大图像大小以创建缩略图。这是一个例子:
问题是,大图像是 732kb,我认为这是可以理解的,因为它的大小很大,但第二个图像仍然是 573kb。
这是正常的还是有什么问题?
这是我的代码调整大小:
\Intervention\Image\Facades\Image::make($originalPath)
->resize($resized_width, $resized_height, function($constraint){
$constraint->aspectRatio();
$constraint->upsize();
})
->save($thumbnailPath, 85);
试试这个代码,你会得到一个小尺寸的图像与纵横比。
$configpath = 'Path of destination';
$width = ($width)?$width:200;
$height = ($height)?$height:200;
$img = Image::canvas($width, $height);
$image = Image::make($path)->resize($width, $height, function ($c) {
$c->aspectRatio();
$c->upsize();
});
// insert resized image centered into background
$img->insert($image, 'center');
$img->save($configpath.$width.'x'.$height.'_'.$filename);
本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处
评论列表(80条)