2017 © Pedro Peláez
 

library identicon

Identicon with variable complexity.

image

ranvis/identicon

Identicon with variable complexity.

  • Saturday, May 7, 2016
  • by ranvis
  • Repository
  • 3 Watchers
  • 9 Stars
  • 278 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 3 Versions
  • 3 % Grown

The README.md

Identicon

Identicon with variable complexity., (*1)

Samples

https://github.com/ranvis/identicon/wiki/Samples, (*2)

License

BSD 2-Clause License, (*3)

Installation

composer require ranvis/identicon:1.0.*, (*4)

1.1 or later may have visual incompatibility with 1.0., (*5)

Upgrading

1.0.x is fully compatible with 1.0.0., (*6)

See CHANGES.md for the details., (*7)

Example Usage

use Ranvis\Identicon;

require_once __DIR__ . '/vendor/autoload.php';

//$hash = md5($userId . 'YOUR_RANDOM_SALT_HERE_&ar/1R#S[|=hDF');

$hash = $_GET['hash'] ?? '';
//$hash = isset($_GET['hash']) ? $_GET['hash'] : ''; // PHP 5
if (!preg_match('/\A[0-9a-f]{32}\z/', $hash)) {
    http_response_code(404);
    exit;
}

$tile = new Identicon\Tile();
$identicon = new Identicon\Identicon(64, $tile);
header('Cache-Control: public, max-age=31556952');
$identicon->draw($hash)->output();

Quick Reference

Identicon::__construct()

__construct($maxSize, TileInterface $tile, $tiles = 6, $colors = 2, $highQuality = true), (*8)

  • int $maxSize maximum size of the icon to draw
  • TileInterface $tile tile to use
  • int $tiles complexity of the icon
  • int $colors maximum usable colors
  • bool $highQuality prefer quality over memory and speed

Identicon->getMinimumHashLength()

getMinimumHashLength(): int, (*9)

get number of hex characters required to draw icon., (*10)

Identicon->draw()

draw($hash): $this, (*11)

draw icon to internal buffer., (*12)

  • string $hash arbitrary hex string

returns $this., (*13)

Identicon->output()

output($size = null, $compression = -1, $filters = -1): bool, (*14)

print PNG image to stdout with Content-Type header., (*15)

  • int $size image size
  • int $compression PNG compression level
  • int $filters PNG filter flags to use

returns true on success., (*16)

Identicon->save()

save($filePath, $size = null, $compression = -1, $filters = -1): bool, (*17)

save PNG image to file., (*18)

  • string $filePath file path to save
  • int $size image size
  • int $compression PNG compression level
  • int $filters PNG filter flags to use

returns true on success., (*19)

Identicon->getImage()

getImage($size = null): resource, (*20)

get icon image., (*21)

  • int $size image size

returns GD image., (*22)

The Versions

07/05 2016

dev-master

9999999-dev https://github.com/ranvis/identicon/blob/master/README.md

Identicon with variable complexity.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.5.0
  • ext-gd *

 

by SATO Kentaro

identicon

07/05 2016

1.0.1

1.0.1.0 https://github.com/ranvis/identicon/blob/master/README.md

Identicon with variable complexity.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.5.0
  • ext-gd *

 

by SATO Kentaro

identicon

23/06 2014

1.0.0

1.0.0.0

Identicon with variable complexity.

  Sources   Download

BSD-2-Clause

The Requires

  • php >=5.5.0
  • ext-gd *

 

by SATO Kentaro

identicon