gstjohn / fastimage
FastImage 通过尽可能少地获取数据,根据uri找到图片的大小或类型,由Tom Moor移植。
v1.0.0
2015-03-16 03:53 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-14 17:00:51 UTC
README
FastImage 通过尽可能少地获取数据,根据uri找到远程图片文件的尺寸或文件类型,基于Stephen Sykes的优秀Ruby实现。
使用方法
<?php require 'Fastimage.php'; $uri = "http://farm9.staticflickr.com/8151/7357346052_54b8944f23_b.jpg"; // loading image into constructor $image = new FastImage($uri); list($width, $height) = $image->getSize(); echo "dimensions: " . $width . "x" . $height; // or, create an instance and use the 'load' method $image = new FastImage(); $image->load($uri); $type $image->getType(); echo "filetype: " . $type;
Composer
要将Fastimage添加为项目依赖,只需将fastimage/fastimage添加到您的项目composer.json文件中。
{ "require": { "fastimage/fastimage": "dev-master" } }
https://packagist.org.cn/packages/fastimage/fastimage
参考
- https://github.com/sdsykes/fastimage
- http://pennysmalls.com/find-jpeg-dimensions-fast-in-pure-ruby-no-ima
- http://snippets.dzone.com/posts/show/805
- http://www.anttikupila.com/flash/getting-jpg-dimensions-with-as3-without-loading-the-entire-file/
- http://imagesize.rubyforge.org/
许可证
FastImage遵循MIT许可证发布。它简单易懂,几乎不对您使用软件的方式施加任何限制。更多信息
下载
可以从GitHub下载发布版本。