Download the PHP package kaolasz/think-glide without Composer

On this page you can find all versions of the php package kaolasz/think-glide. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package think-glide

申明:Fork自 zzstudio/think-glide , 由于原项目未支持thinkphp8,所以fork一份用在tp8上,别无它意。

thinkphp6 升级到 thinkphp8 时,可直接卸载原zzstudio/think-glide库,然后安装新库kaolasz/think-glide,代码不用做任何改动。

ThinkPHP6+ 图片动态裁剪缩放库

Glide fork from Glide 是一个可以帮助你根据指定参数动态的生成图片内容给浏览器的图片操作库,从而实现 图片动态裁剪,打水印等,本库对 Glide 进行了一些友好的包装与扩展,屏蔽了原生库的一些底层抽象从而使得 ThinkPHP 用户可以在 ThinkPHP8 项目中 更好的添加图片的动态裁剪功能。

Installation

执行下面命令安装:

Usage

Quick start

生成配置

系统安装后会自动在 config 目录中生成 glide.php 的配置文件, 如果系统未生成可在命令行执行

快速生成配置文件

参数说明

参数名 类型 说明 是否必选
source string 本地文件夹位置
cache string 缓存文件位置,默认在 runtime/glide 下面
cacheTime string 缓存时间,示例 +2 days, 缓存期间多次请求会自动响应 304
signKey string 安全签名
onException callable 异常处理handler
baseUrl string 路由前缀,匹配到该前缀时中间件开始执行,默认是 /images

source 是你本地图片文件夹的位置,假设该目录下有图片 user.jpg, 打开浏览器访问下面链接:

即可得到缩小后的图片。

安全签名

不开启安全签名的情况下用户可以调整query里面的参数自行对图片进行裁剪,如果你不打算这么做的话,你可以通过 signKey 进行校验,

这种情况下用户自行调整参数将会无效;生成安全的URL:

异常处理

如果用户访问了一张不存在的图片或者没有进行安全校验,系统会抛出异常,你可以通过修改配置文件中 onException 进行替换默认行为:

nginx 配置

注意该闭包必须返回一个 think\Response 实例;

Quick reference

不止支持裁剪,glide还支持其它操作,只要传递对应参数即可,参考这里查看支持的参数:

http://glide.thephpleague.com/1.0/api/quick-reference/

License

See MIT.


All versions of think-glide with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0.0
topthink/framework Version ^8.0
league/glide Version ^2.3
symfony/options-resolver Version ^2.0|^3.0|^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kaolasz/think-glide contains the following files

Loading the files please wait ....