diff options
author | Tom Moor <tom.moor@gmail.com> | 2012-06-11 19:02:12 +0800 |
---|---|---|
committer | Tom Moor <tom.moor@gmail.com> | 2012-06-11 19:02:12 +0800 |
commit | 927d321a4e544800b98e52d9a10f254be23266cb (patch) | |
tree | e333789227201dfb79a4c419bf302c585a63baf3 | |
parent | 49367fa3f24b5cec2e9bc3aadd6eda47d90f769a (diff) | |
download | fastimage-927d321a4e544800b98e52d9a10f254be23266cb.zip fastimage-927d321a4e544800b98e52d9a10f254be23266cb.tar.gz fastimage-927d321a4e544800b98e52d9a10f254be23266cb.tar.bz2 |
Camelcased FastImage class name
Added full example code including and require
-rw-r--r-- | Fastimage.php | 2 | ||||
-rw-r--r-- | README.md | 13 | ||||
-rw-r--r-- | examples/index.php | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/Fastimage.php b/Fastimage.php index aa69467..5c3bf4a 100644 --- a/Fastimage.php +++ b/Fastimage.php @@ -11,7 +11,7 @@ * @version 0.1 */ -class Fastimage +class FastImage { private $strpos = 0; private $str; @@ -5,15 +5,24 @@ FastImage finds the dimensions or filetype of a remote image file given its uri ## Usage - $image = new Fastimage($uri); + <?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; - $image = new Fastimage(); + // or, create an instance and use the 'load' method + $image = new FastImage(); $image->load($uri); $type $image->getType(); echo "filetype: " . $type; + ## References * https://github.com/sdsykes/fastimage diff --git a/examples/index.php b/examples/index.php index f1eb9c0..ebfeba4 100644 --- a/examples/index.php +++ b/examples/index.php @@ -7,7 +7,7 @@ $uri = 'http://pcdn.500px.net/8123858/7051e2440a869a3fec74406a3aa200618452c390/4 echo "\n\n"; $time = microtime(true); -$image = new Fastimage($uri); +$image = new FastImage($uri); $size = $image->getSize(); echo "Width: ". $size[0] . "px Height: ". $size[1] . "px in " . (microtime(true)-$time) . " seconds \n"; |