simexis / thumbalizr
此包最新版本(1.1)没有提供许可信息。
1.1
2015-05-27 13:42 UTC
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2024-09-15 00:08:18 UTC
README
为 Laravel 5 定制的 Thumbalizr 类
使用 thumbalizr.com 的 API
要求
- Laravel 5.X
- php 5.4+
安装
步骤 1:使用 Composer 安装包
将 simexis/thumbalizr 添加到 composer.json 文件的 "require" 部分
"require": { "simexis/thumbalizr": ">=1.0" },
将仓库添加到 composer.json 文件的 "repositories" 部分
"repositories": [ { "type": "vcs", "url": "https://github.com/jooorooo/Thumbalizr.git" }],
然后使用以下命令安装依赖项
php composer.phar install
步骤 2:Laravel 设置
将以下行添加到 app/config/app.php 文件的 'providers' 部分
'Simexis\Thumbalizr\ThumbalizrServiceProvider',
用法
默认配置是
$cfg = [ 'api_key' => "", //put your api key here 'service_url' => "http://api.thumbalizr.com/", // don't change, if you didn't have a special service contract 'use_local_cache' => TRUE, // TRUE or FALSE for local image cache 'local_cache_dir' => public_path()."/thumbs", //relative cache directory must exists in install directory and rwx permissions to all (777) 'local_cache_expire'=> 24*14, // local chache expiration time in hours 'defaults' => [ 'width' => "400", // image width 'delay' => "10", // caputre delay useful for flash content 5 - 10 is a good value 'encoding' => "png", // jpg or png 'quality' => "90", //image quality 10-90 'bwidth' => "1280", // browser width 'mode' => "screen", // screen or page 'bheight' => "1024" // browser height only for mode=screen ] ];
基本示例
$cfg = [ 'api_key' => "..............", 'defaults' => [ 'width' => "250", // image width ] ]; echo \Thumbalizr::getThumbSrc('http://google.com',$cfg);