ramoose / hold-my-place
Generate base64 placeholder images.
v0.4
2018-11-25 06:33 UTC
Requires (Dev)
- kint-php/kint: ^3.0
This package is auto-updated.
Last update: 2025-02-25 20:51:33 UTC
README
Motivation
Makes prototyping easier: no external placeholder image service needed, no local image library needed.
Just make your pixel image and scale with CSS. That's it.
usage (with composer)
Require
require __DIR__."/app/vendor/autoload.php"; use Ramoose\HoldMyPlace\Base64pixel as B64; // B64::create(string $color, string $format);
HTML examples
Create your pixel. See php
documentation on ImagickPixel::__construct
for color code options. link
<img class="placeholder" src="<?=B64::create("red")?>"/> <img class="placeholder" src="<?=B64::create("green")?>"/> <img class="placeholder" src="<?=B64::create('rgb(0, 0, 0)')?>"/>
Methods
Base64pixel::create(string $color = 'red', string $format = 'png');
Base64pixel::random(string $format = 'png');
Demo
composer test
will execute the following: php -S localhost:8000 ./test.php
You can then see the demo in your browser by navigating to http://localhost:8000
.
The demo page will also give you a list of image formats you build of Imagick
supports.