1,375   Composer Laravel PHP

laravel5图片处理类,intervention image
说明地址:
http://image.intervention.io/getting_started/introduction

1,添加类库


composer require "intervention/image:2.3.*"

2,使用

            $img = Image::make($localFullPath);

            $height = $img->height();
            $width = $img->width();

            if($width > 900){
                $resize_width = 900;
                $resize_heigth = $height*900/$width;

                $resize_safeName = $resize_width."X".$resize_heigth."_".$safeName;
                $resize_localFullPath = $destinationPath.$resize_safeName;
                $img->resize($resize_width, $resize_heigth)->save($resize_localFullPath);

                $httpFullPath = route('home') . $folderName . $resize_safeName;

            }




Leave a Reply

Your email address will not be published. Required fields are marked *