ilaoniu/dummyimage 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ilaoniu/dummyimage

最新稳定版本:v1.0.1

Composer 安装命令:

composer require ilaoniu/dummyimage

包简介

Dummy Image.

关键字:

README 文档

README

Install

composer require ilaoniu/dummyimage --dev

Laravel

First, add a new route:

Route::middleware('cache.headers:public;max_age=2628000;etag')->get('__dummy-image/{size}/{bgColor?}/{textColor?}', function (Request $request, string $size, ?string $bgColor = null, ?string $textColor = null) {
    $dummyImage = new DummyImage;
    ['content' => $content, 'headers' => $headers] = $dummyImage->image($size, $bgColor, $textColor, $request->query('text'));

    return response($content)->withHeaders($headers);
});

Then, you can get image url like this:

$dummyImage = new DummyImage;
$dummyImage->imageUrl(config('app.url') . '/__dummy-image');

Usage

Size

width x height

Colors

background color / text color

Image Formats

.gif, .jpg, .png, .webp

  • Adding an image file extension will render the image in the proper format
  • Image format is optional and the default is a gif
  • jpg and jpeg are the same
  • The image extension can go at the end of size option in the url

Custom Text

?text=Hello+World

  • Custom text can be entered using a query string at the very end of the url
  • This is optional, default is the image dimensions (300×250)
  • a-z (upper and lowercase), numbers, and most symbols will work just fine.
  • Spaces become +

Thanks

https://github.com/kingkool68/dummyimage, Dummy Image is written in PHP and distributed freely under a MIT License.

Source code behind https://dummyimage.com

统计信息

  • 总下载量: 115
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-15