http://image.intervention.io/

安装两个包

composer require intervention/image

composer require intervention/imagecache

使用

$img = Image::make('public/foo.jpg')->resize(, )->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(, ); // 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\/\._]+']);

intervention/image intervention/imagecache的更多相关文章

  1. Composer包收录

    doctrine/annotations #注解 nesbot/carbon #日期和时间处理 gregwar/captcha symfony/console nikic/fast-route #路由 ...

  2. 2016年美国数学建模比赛(MCM/ICM) E题环境科学 Are we heading towards a thirsty planet? 人工精准翻译。

    第二次参加建模,觉得建模太有趣了,用几天的时间,迅速学习新知识,并解决实际问题. ——————————————————————————————————————————————————————————— ...

  3. 推荐 Laravel API 项目必须使用的 8 个扩展包

    如今在现代网络开发中,比较流行的模式是基于 API 开发,可以通过手机或网站来创建服务. Laravel 是创建基于 API 的项目的最佳框架之一,它为世界各地的大型社区提供了高速开发. Larave ...

  4. (翻译)2016美国数学建模MCM E题(环境)翻译:我们朝向一个干旱的星球?

    PROBLEM E: Are we heading towards a thirsty planet? Will the world run out of clean water? According ...

  5. PHP之50个开源项目

    GitHub上50个最受欢迎的PHP开源项目[2019] 1.Laravel Laravel是一个为Web开发者打造的PHP开发框架. GitHub Stars: 43.5k+ 网址: https:/ ...

  6. laravel扩展图片处理Intervention Image

    github地址:https://github.com/Intervention/image

  7. vux 使用swiper 垂直滚动文字 报错[Intervention] Ignored...

    [Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example becaus ...

  8. [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.

    1.滑动时候警告[Intervention] Unable to preventDefault inside passive event listener due to target being tr ...

  9. vue使用swiper模块滑动时报错:[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example becaus

    报错: vue报这个错 [Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for ex ...

随机推荐

  1. DRF如何序列化外键的字段

    我觉得在有些应用场景下,这个操作是有用的,因为可以减少一个AJAX的请求,以增加性能. 当然,是二次请求,还是一次传输.这即要考虑用户体验,还要兼顾服务器性能. 一切是有条件的平衡吧.就算是一次传输, ...

  2. solr使用

    到网站上面下载solr http://archive.apache.org/dist/lucene/solr/4.7.2/ 链接: http://archive.apache.org/dist/luc ...

  3. GRE词汇3-4 +

    page3 accommodate: common commodity accompany: Accomplice:  com—共同 plic—重叠 Complicate duplicate repl ...

  4. Codeforces Round #313 (Div. 2) A. Currency System in Geraldion

    A. Currency System in Geraldion Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/co ...

  5. mysql死锁问题

    形成死锁的条件 我们mysql用的存储引擎是innodb,从日志来看,innodb主动探知到死锁,并回滚了某一苦苦等待的事务. 问题来了,innodb是怎么探知死锁的? 直观方法是在两个事务相互等待时 ...

  6. js:语言精髓笔记8--对象系统

    封装: 一把对象系统,封装是由语法解析来实现的,即语法作用域:但js是动态语言,因此只能依赖变量作用域: js的变量作用域只有表达式,函数,全局三种:所以js只能实现public和private两种封 ...

  7. LCS(打印路径) POJ 2250 Compromise

    题目传送门 题意:求单词的最长公共子序列,并要求打印路径 分析:LCS 将单词看成一个点,dp[i][j] = dp[i-1][j-1] + 1 (s1[i] == s2[j]), dp[i][j] ...

  8. Task加入取消功能

      参考:http://www.cnblogs.com/scy251147/archive/2013/01/04/2843875.html static void TaskWithCancellati ...

  9. MBR 基础

    1.简介 MBR,全称为Master Boot Record,即硬盘的主引导记录,它位于整个硬盘的0磁道0柱面1扇区,其主要对硬盘进行了组织,是在驱动器最前端的一段引导扇区. MBR是不属于任何一个操 ...

  10. FZU2219 StarCraft(哈夫曼树)

    一个工人可以变成两个工人,这样可以画出一颗二叉树,那么就是在叶子上建的建筑. 问题的时间花费,可以看作是这颗二叉树中各个叶子的深度*k+叶子对应建筑耗费时间中的最大值. 容易想到,类似哈夫曼树一样,从 ...