cinghie/yii2-tinify
Composer 安装命令:
composer require cinghie/yii2-tinify
包简介
Yii2 integration for TinyPng
关键字:
README 文档
README
Yii2 integration for TinyPng: https://tinypng.com/
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require cinghie/yii2-tinify "^1.0.2"
or add this line to the require section of your composer.json file.
"cinghie/yii2-tinify": "^1.0.2"
Usage
Initialize component: https://tinypng.com/developers/reference/php#authentication
$tinify = new Tinify(['apiKey' => 'YOUR API KEY']);
Compress image from Path: https://tinypng.com/developers/reference/php#compressing-images)
// create a new image
$tinify->compress('path/to/file/to/compress','path/to/file/after/compression');
// overwrite file
$tinify->compress('path/to/file/to/compress');
Compress image from Buffer: https://tinypng.com/developers/reference/php#compressing-images)
$tinify->compressFromBuffer('path/to/file/to/compress');
Compress image from Url: https://tinypng.com/developers/reference/php#compressing-images)
$tinify->compressFromUrl('https://tinypng.com/images/panda-happy.png','path/to/file/after/compression');
Resize image: https://tinypng.com/developers/reference/php#resizing-images
// create a new image
$tinify->resize('path/to/file/to/compress','path/to/file/after/compression',['method' => 'fit', 'width' => 150, 'height' => 100]);
// overwrite file
$tinify->resize('path/to/file/to/compress',null,['method' => 'fit', 'width' => 150, 'height' => 100]);
// Available methods
scale,fit,cover,thumb
Store image to Amazon S3: https://tinypng.com/developers/reference/php#saving-to-amazon-s3
$tinify = new Tinify([
'apiKey' => 'YOUR API KEY',
'aws_access_key_id' => 'YOUR_AWS_ID_KEY',
'aws_secret_access_key' => 'YOUR_AWS_ACCESS_KEY',
'headers' => array('Cache-Control' => 'max-age=31536000, public'),
'path' => 'example-bucket/my-images/optimized.jpg',
'region' => 'us-west-1'
]);
$tinify->storeToAmazonS3('path/to/file/to/compress');
Compressions used this month: https://tinypng.com/developers/reference/php#compression-count
$count = $tinify->usage();
cinghie/yii2-tinify 适用场景与选型建议
cinghie/yii2-tinify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.2k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yii2」 「yii2 tinypng」 「yii2 tinify」 「yii2 optimization」 「yii2 compression」 「yii2 image compression」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cinghie/yii2-tinify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cinghie/yii2-tinify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cinghie/yii2-tinify 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Make your web shop faster by compressing your JPEG and PNG images. This plugin automatically optimizes your images by integrating with the popular image compression services TinyJPG and TinyPNG.
A custom URL rule class for Yii 2 which allows to create translated URL rules
Facade of Tinify API for Yii2 Framework
SCEditor, a lightweight WYSIWYG BBCode & HTML editor extension for Yii 2.0 Framework
Laravel Facade for tinify API
Pimcore Bundle - Minifies your PNG and JPEG Assets on uploading to Pimcore
统计信息
- 总下载量: 1.2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 5
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2018-11-06