tigron/skeleton-file-picture
最新稳定版本:v0.2.22
Composer 安装命令:
composer require tigron/skeleton-file-picture
包简介
Tigron File utilities
README 文档
README
Description
This library can resize images. The image must be of type \Skeleton\File\File
Installation
Installation via composer:
composer require tigron/skeleton-file-picture
Create a new table in your database:
CREATE TABLE IF NOT EXISTS `picture` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`file_id` int(11) NOT NULL,
`width` int(11) NOT NULL,
`height` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `file_id` (`file_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
Howto
Check the \Skeleton\File README to initialize the File Store
Initialize the picture library:
/**
* This function adds a picture configuration
*
* $params = [
* 'width' => width in px,
* 'height' => height in px
* 'mode' => exact/crop/auto
* exact => The $height/$width will be used, ratio is ignored
* crop => The image is cropped in in order to fill the $height/$width frame
* auto => The image is resized to fit the $height/$width frame, ratio is kept
* 'format' => image/jpeg|image/gif|image/png|image/webp|original
*/
\Skeleton\File\Picture\Config::add_configuration($params);
/**
* Set the cache path
* This is default set to the system TMP path
*
* \Skeleton\File\Picture\Config::$tmp_dir is deprecated
*/
\Skeleton\File\Picture\Config::$tmp_path = $your_very_temporary_path
Show a resized picture:
$picture = Picture::get_by_id(1);
$picture->resize($configuration_name);
统计信息
- 总下载量: 17.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-14