bitandblack/image-information

Reading information of images

2.0.1 2023-11-13 12:47 UTC

This package is auto-updated.

Last update: 2024-06-13 14:13:22 UTC


README

PHP from Packagist Latest Stable Version Total Downloads License

Bit&Black ImageInformation

Read information of images:

  • The size
  • The color profile

Currently supported files and extensions:

  • ai Adobe Illustrator Artwork
  • bmp Windows Bitmap
  • eps Encapsulated PostScript
  • gif Graphics Interchange Format
  • ico Initial Coin Offering
  • iff Interchange File Format
  • jp2, jpf (Extended) JPEG 2000
  • jpg, jpeg Joint Photographic Experts Group
  • pdf Portable Document Format
  • png Portable Network Graphics
  • psd (Adobe) Photoshop Document
  • svg Scalable Vector Graphics
  • tif, tiff Tagged Image File Format
  • wbmp Wireless Application Protocol Bitmap Format
  • webp Google WebP

Installation

This package is made for the use with Composer. Add it to your project by running $ composer require bitandblack/image-information.

Usage

Define your file with the File class. Init the Image class then and add your file:

<?php

use BitAndBlack\ImageInformation\Image;
use BitAndBlack\ImageInformation\Source\File;

$file = new File('MyFile.eps');
$image = new Image($file);

Access the image size: $image->getSize();

Access the images color profile: $image->getICCProfile();

Cache

You can speed up the library by using a cache. When initializing the image class, add a cache object as second parameter:

<?php

use BitAndBlack\ImageInformation\Cache\Cache;
use BitAndBlack\ImageInformation\Image;
use BitAndBlack\ImageInformation\Source\File;

$file = new File('MyFile.eps');
$image = new Image($file, new Cache());

Per default, the cache class uses a file system cache. This can be configured as only a PSR cache compatible class is needed.

Help

If you have questions feel free to contact us under hello@bitandblack.com.

Further information about Bit&Black can be found under www.bitandblack.com.