romaricdrigon / fastimage
通过获取所需的最少数据来找到远程图片的大小和类型。Ruby版fastImage的PHP端口。
0.9.2
2015-08-18 12:38 UTC
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2024-09-08 22:14:54 UTC
README
FastImage通过尽可能少的数据获取来找到给定URI的远程图像文件的大小或文件类型,基于Stephen Sykes的优秀的Ruby实现。
这个版本是从Tom Moor的PHP端口分叉的,并引入了一些改动
- 使用异常
- 自定义HTTP头
- 命名空间,Composer就绪
用法
<?php require 'Fastimage.php'; $uri = "http://farm9.staticflickr.com/8151/7357346052_54b8944f23_b.jpg"; // loading by creating an instance and use the 'load' method $image = new FastImage(); $image->load($uri); $type = $image->getType(); echo "filetype: " . $type;
参考
- 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许可证下发布。它简单易懂,对软件的使用几乎没有限制。 更多信息