承接 sebastiansulinski/file 相关项目开发

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

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

sebastiansulinski/file

最新稳定版本:v2.2.0

Composer 安装命令:

composer require sebastiansulinski/file

包简介

File information package

README 文档

README

File information package for different file types. Currently contains only Image file type implementation.

Usage

require_once "vendor/autoload.php";

use SSD\File\File;
use SSD\File\Type\Image;


$image = new Image(new File('/path/to/the/file.jpg'));

// File specific info
echo $image->path(); // /path/to/the/file.jpg
echo $image->name(); // file.jpg
echo $image->nameWithoutExtension(); // file
echo $image->extension(); // jpg
echo $image->extension(true); // .jpg
echo $image->mimeType(); // image/jpeg

// Size specific info
echo $image->sizeInBytes(); // 49275
echo $image->sizeInBytesPostfix(); // 49275B
echo $image->sizeInKiloBytes(); // 48.12
echo $image->sizeInKiloBytesPostfix(); // 48.12KB
echo $image->sizeInMegaBytes(); // 0.05
echo $image->sizeInMegaBytesPostfix(); // 0.05MB
echo $image->sizeInMegaBytesPostfix(3, ' '); // 0.047 MB

// Image specific info
echo $image->width(); // 600
echo $image->height(); // 450
echo $image->type(); // 1
echo $image->attributes(); // width="600" height="450"
echo $image->isLandscape(); // true / false
echo $image->isPortrait(); // true / false
echo $image->isOfType(IMG_JPG, IMG_PNG); // true / false

// Methods returning all of the above

// as array
$image->toArray();

// as json
$image->toJson();

// as json
$image->toString();

// as json using __toString()
echo $image;

统计信息

  • 总下载量: 7.11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-27