<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                打開config/filesystems.php ~~~ 'links' => [ public_path('storage') => storage_path('app/public'), public_path('images') => storage_path('app/images'), ], ~~~ 執行命令 ~~~ php artisan storage:link ~~~ 上傳圖片代碼 ~~~ /** * 圖片上傳 * Created by WML * Created on 2021/8/3 * @param $request * @return array|false|string */ public function image(Request $request) { $file = $request->file("image"); $extension = $file->extension();//獲取文件名后綴 $ext_arr = ['jpg','gif','png','jpeg','svg','JPG','GIF','PNG','JPEG','SVG','Jpg','Gif','Jpeg','Svg','Png']; if(!in_array($extension,$ext_arr)) return errorMsg(-1,"文件格式不正確"); $path = $file->store('/images'); $secure = $request->secure() ? 'https://' : 'http://'; $data = [ 'path' => $path, 'site_path' => $secure.$_SERVER['SERVER_NAME'].'/'.$path, ]; return successMsg($data); } ~~~ 對圖片進行處理 ## 1.安裝 使用Composer在命令行安裝最新版本的Intervention Image: `composer require intervention/image` ## 2.集成到Laravel 安裝好Intervention Image后,打開config/app.php,注冊如下服務提供者到$providers數組: `Intervention\Image\ImageServiceProvider::class` 然后添加如下門面到$aliaes數組: `'Image' => Intervention\Image\Facades\Image::class` 這樣我們就可以在Laravel應用代碼中直接使用Image了。 ## 3.配置 默認情況下,Intervention Image使用PHP的GD庫擴展處理所有圖片,如果你想要切換到Imagick,你可以將配置文件拉到應用中: `php artisan vendor:publish --provider="Intervention\\Image\\ImageServiceProviderLaravelRecent"` ~~~ //圖片上傳 use Intervention\Image\ImageManagerStatic as Image; public function imageLocalUpload(Request $request){ $file = $request->file('image'); $width = $request->width ?? 80; $height = $request->height ?? 80; $ext_arr = Config::get('filesystems',array())['ext']; $extension = $file->extension();//獲取文件名后綴 if(!in_array($extension,$ext_arr)) except(493,'文件格式不正確'); $name = date("YmdHis",time()).rand(1000,999); $min_path = 'images/'.$name.'_min.'.$extension; $path = $file->storeAs('/images',$name.'.'.$extension); Image::make($file)->resize($width,$height)->save($min_path); //圖片壓縮并保存 $url = env('APP_URL','http://'.$_SERVER['SERVER_NAME']); $data = [ 'path' => $path, 'old_url' => $url.'/'.$path,//原圖 'site_path' => $url.'/'.$min_path ]; return $this->success($data); } ~~~ 更多圖片處理 請訪問 http://image.intervention.io/
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看