承接 andrewdanilov/yii2-thumbs 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

andrewdanilov/yii2-thumbs

Composer 安装命令:

composer require andrewdanilov/yii2-thumbs

包简介

Image resize and cache

README 文档

README

Provides widget class for resizing and caching images

Installation

The preferred way to install this extension is through composer.

Either run

composer require andrewdanilov/yii2-thumbs "~1.1.0"

or add

"andrewdanilov/yii2-thumbs": "~1.1.0"

to the require section of your composer.json file.

Usage

$src = \andrewdanilov\thumbs\Thumb::widget([
    'image' => '/images/img.png', // Image to resize and cache relative to base site uri
    'sizes' => '100x100', // Optional. Result image sizes. String devided with 'x' or array with 'width' and 'height' keys. Default is '100x100'
    'zc' => true, // Optional. Zoom and crop. Default is true.
    'quality' => 90, // Optional. Jpeg quality from 1 to 100. Default is 90
    'backgroundColor' => 'transparent', // Optional. Values like 'transparent', 'FFF', '000000'. Default is 'transparent'
    'noImageUri' => '/images/noimg.png', // Optional. Path to image to use for empty or absent images relative to base site uri
    'cachePath' => '/assets/thumbs/', // Optional. Path to store cached images relative to base site uri. Default is '/assets/thumbs/'
    'cacheTime' => 604800, // Optional. Time to chache in seconds. Default is 604800
]);
echo \yii\helpers\Html::img($src);

In the sizes parameter, you can specify one or both of the width and height parameters. You can describe this in string notation with the 'x' delimiter, or in array notation with the keys width and height:

// width x height string notation
$sizes = '400x200';
$sizes = '400x';
$sizes = 'x200';
// array notation
$sizes = ['width' => 400, 'height' => 200];
$sizes = ['width' => 400];
$sizes = ['height' => 200];

If both sizes are specified, then depending on the value of the zc parameter, the resulting image will be cropped (zc = true) or padded (zc = false) with fields with the color specified in the backgroundColor parameter.

The URI in the noImageUri parameter must exist. If you don't have it, you can copy it from /vendor/andrewdanilov/yii2-thumbs/src/web/images/noimage.png to your location.

If the path from the cachePath parameter does not exist, it will be created.

统计信息

  • 总下载量: 110
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固