Skip to content

bitheater/dummy-image

Repository files navigation

Dummy Image Generator

Build Status Scrutinizer Code Quality

This library is a dummy image generator for your PHP projects. We find it very useful for creating of fixtures for our projects.

Installing

Add the dependency to the composer.json file:

{
    "require": {
        "bitheater/dummy-image": "dev-master"
    }
}

A minimum working version (for local image generation):

<?php

use Bitheater\DummyImage\Generator\LocalGenerator;

$generator = new LocalGenerator(ImagineFactory::GD); // You could also use IMAGICK and GMAGICK
$result = $generator->generate(__DIR__ . '/image.png');

Local image generation is good when you don't have access to the external service (or maybe you need to create fixtures without internet connection). Local generation needs GD, IMAGICK or GMAGICK installed on your server.

A minimum working version (for remote image generation):

<?php

use Bitheater\DummyImage\Generator\RemoteGenerator;
use Guzzle\Http\Client;

$generator = new RemoteGenerator(new Client());
$result = $generator->generate(__DIR__ . '/image.png');

Remote image generation uses DummyImage website as the generator for the images.

Options

<?php

use Bitheater\DummyImage\Generator\LocalGenerator;

$generator = new LocalGenerator(ImagineFactory::GD);
$result = $generator->generate(__DIR__ . '/image.png');

License

Dummy Image Generator is licensed under the MIT license.

About

Generate dummy images for your PHP projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages