zoukankan      html  css  js  c++  java
  • intervention/image intervention/imagecache

    http://image.intervention.io/

    安装两个包

    composer require intervention/image
    
    composer require intervention/imagecache

    使用

    $img = Image::make('public/foo.jpg')->resize(320, 240)->insert('public/watermark.png')->save('public/bar.jpg');
    // resizing an uploaded file
    Image::make(Input::file('photo'))->resize(300, 200)->save('foo.jpg');

    Creating Image from File Upload

    // read image from temporary file
    $img = Image::make($_FILES['image']['tmp_name']);
    
    // resize image
    $img->fit(300, 200);
    
    // save image
    $img->save('foo/bar.jpg');

    laravel router

    Route::get('/image/{path}', function($path){
        $img = Image::cache(function($img) use($path) {
                       $img->make(public_path().'/'.$path)->resize(300, 200);
                }, 10, true);
        return $img->response('jpg');
    })->where(['path' => '[0-9a-z/._]+']);
  • 相关阅读:
    元素的属性
    表单
    Array数组类
    string类
    js数据类型以及原型分析
    this
    有关兼容性的解决
    单位
    滚动条 和 背景位置及绝对定位
    圣杯布局 和 双飞翼布局
  • 原文地址:https://www.cnblogs.com/fenle/p/5010212.html
Copyright © 2011-2022 走看看