ramoose/hold-my-place

生成base64占位图像。

v0.4 2018-11-25 06:33 UTC

This package is auto-updated.

Last update: 2024-09-25 20:02:19 UTC


README

动机

使原型设计更简单:无需外部占位图像服务,无需本地图像库。

只需创建像素图像并使用CSS进行缩放。就是这样。

用法(使用composer)

需求

require __DIR__."/app/vendor/autoload.php";

use Ramoose\HoldMyPlace\Base64pixel as B64;

// B64::create(string $color, string $format);

HTML示例

创建您的像素。请参阅有关ImagickPixel::__construct的颜色代码选项的php文档。链接

<img class="placeholder" src="<?=B64::create("red")?>"/>
<img class="placeholder" src="<?=B64::create("green")?>"/>
<img class="placeholder" src="<?=B64::create('rgb(0, 0, 0)')?>"/>

方法

Base64pixel::create(string $color = 'red', string $format = 'png'); Base64pixel::random(string $format = 'png');

演示

运行composer test将会执行以下操作:php -S localhost:8000 ./test.php

您可以通过在浏览器中导航到https://:8000来查看演示。

演示页面还会为您提供由Imagick支持的图像格式列表。