2017 © Pedro Peláez
 

library faker-someimage-providers

Fake image providers for Faker PHP library (fzaninotto/Faker). Implemented providers: LoremFlickr (http://loremflickr.com), DummyImage (http://dummyimage.com)

image

dmdnkv/faker-someimage-providers

Fake image providers for Faker PHP library (fzaninotto/Faker). Implemented providers: LoremFlickr (http://loremflickr.com), DummyImage (http://dummyimage.com)

  • Saturday, June 25, 2016
  • by dmdnkv
  • Repository
  • 1 Watchers
  • 1 Stars
  • 128 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 29 % Grown

The README.md

Faker LoremFlickr Provider

Fake images provider for Faker PHP library., (*1)

There are several image providers implemented: - LoremFlickr (LoremFlickr service is used as images source). - DummyImage (Dynamic Dummy Image Generator service is used as images source)., (*2)

Installation

composer require dmdnkv/faker-someimage-provider

Basic Usage

LoremFlickr


use Dmdnkv\Faker\Provider\LoremFlickr; /** * Add LoremFlickr provider to faker generator */ $faker = new Faker\Generator(); $faker->addProvider(new LoremFlickr($faker)); /** * Get url to random picture matching the keywords brazil or rio, of 320 x 240 pixels. */ $imageUrl = $faker->someImageUrl( 320, 240, [ LoremFlickr::OPTION_KEYWORDS => ['brazil', 'rio'] ] ); /** * Get url to random picture matching the keywords paris and girl, of 320 x 240 pixels. */ $imageUrl = $faker->someImageUrl( 320, 240, [ LoremFlickr::OPTION_KEYWORDS => ['paris', 'girl'], LoremFlickr::OPTION_LOGIC => LoremFlickr::KEYWORDS_LOGIC_AND, ] ); /** * Get url to random picture matching the keywords brazil or rio, of 320 x 240 pixels. * There is color filter applied to image (available filters: gray, red, green, blue). */ $imageUrl = $faker->someImageUrl( 320, 240, [ LoremFlickr::OPTION_KEYWORDS => ['brazil', 'rio'], LoremFlickr::OPTION_FILTER => LoremFlickr::FILTER_GRAY, ] ); /** * Download random picture matching the keywords brazil or rio, of 320 x 240 pixels. * Save picture to system temp folder and return filename only. */ $fileName = $this->faker->someImage( 320, 240, [ LoremFlickr::OPTION_KEYWORDS => ['brazil', 'rio'], LoremFlickr::OPTION_DIR => sys_get_temp_dir(), LoremFlickr::OPTION_FULL_PATH => false ] );

DummyImage


use Dmdnkv\Faker\Provider\DummyImage; /** * Add DummyImage provider to faker generator */ $faker = new Faker\Generator(); $faker->addProvider(new DummyImage($faker)); /** * Get url to PNG picture with black background color and white text `some text here` */ $imageUrl = $faker->someImageUrl( 320, 240, [ DummyImage::OPTION_BG_COLOR => '000000', DummyImage::OPTION_FG_COLOR => 'ffffff', DummyImage::OPTION_TEXT => 'some text here', DummyImage::OPTION_EXTENSION => DummyImage::EXTENSION_PNG, ] ); /** * Download PNG picture with black background color and white text `some text here`. * Save picture to system temp folder and return filename only. */ $fileName = $faker->someImageUrl( 320, 240, [ DummyImage::OPTION_BG_COLOR => '000000', DummyImage::OPTION_FG_COLOR => 'ffffff', DummyImage::OPTION_TEXT => 'some text here', DummyImage::OPTION_EXTENSION => DummyImage::EXTENSION_PNG, DummyImage::OPTION_DIR => sys_get_temp_dir(), DummyImage::OPTION_FULL_PATH => false, ] );

The Versions

25/06 2016

dev-master

9999999-dev

Fake image providers for Faker PHP library (fzaninotto/Faker). Implemented providers: LoremFlickr (http://loremflickr.com), DummyImage (http://dummyimage.com)

  Sources   Download

MIT

The Requires

 

The Development Requires

25/06 2016

1.0.0

1.0.0.0

Fake image providers for Faker PHP library (fzaninotto/Faker). Implemented providers: LoremFlickr (http://loremflickr.com), DummyImage (http://dummyimage.com)

  Sources   Download

MIT

The Requires

 

The Development Requires