我认为干预图片库的大小调整功能中没有此选项。您可以使用getimagesize()
php函数获取高度和宽度,并将宽度除以5(在您的情况下为5,因为您希望5:1)来获取高度。
$image=getimagesize($image_file);
$width=$image[0]; // $image[0] is the width
$height=$image[0]/5; // $image[1] is the height
比起您可以只使用干预resize()
功能将大小调整为该高度和宽度。
Image::make($source_image)
->resize($width,$height ,false,false)
->save($destination);`
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句