cygnite/file

Cygnite 文件组件。此包用于文件上传、创建缩略图等。

v1.0.2 2015-06-07 14:07 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:58:08 UTC


README

#安装

Array Manipulator 使用 Composer 进行安装。有关 Composer 文档的安装,请参阅 getcomposer.org。在您的 composer.json 中添加以下内容。

"cygnite/file" : "1.*"

Cygnite 文件组件处理文件上传和创建缩略图等。

使用文件组件上传文件。

示例用法

use Cygnite\Common\File\Upload\Upload;

$status = Upload::process( function($upload)
{
	// Your code goes here
	$upload->file = 'document';
	$upload->ext = array("JPG");
	$upload->size = '32092';

	if ( $upload->save(array("destination"=> "upload", "fileName"=>"file_new_name")) ) {
		 // Upload Success
	} else {
		 // Error catch here
	}
});

// var_dump($status);

图片裁剪/缩略图

创建缩略图。

示例用法

use Cygnite\Common\File\Thumbnail\Image;

$thumb = new Image();
$thumb->directory = 'Set your directory path';
$thumb->fixedWidth = 100;
$thumb->fixedHeight = 100;
$thumb->thumbPath = 'your thumbnail image path';
$thumb->thumbName = 'Your thumbnail image name';
// Optional. If you doen't want to have custom name then it will generate thumb as same name of original image.
$thumb->resize();