Package Data | |
---|---|
Maintainer Username: | samcrosoft |
Maintainer Contact: | samcrosoft@gmail.com (Samuel Olowofela) |
Package Create Date: | 2015-06-01 |
Package Last Update: | 2015-06-03 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-15 15:25:32 |
Package Statistics | |
---|---|
Total Downloads: | 1,737 |
Monthly Downloads: | 3 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This is a simple package that creates image placeholders using the GD Library. It makes it possible to self host a service to create an imge placeholder just like (placehold.it)
composer require samcrosoft/placeholder:"dev-master"
To create a simple image placeholder that would be returned as an http response is simple as described below
<?php
require 'vendor/autoload.php';
use Samcrosoft\Placeholder\Placeholder;
header ("Content-type: image/png");
/*
* Generate an image object
*/
$oPlaceholder = new Placeholder();
/*
* Make a placeholder using parameters from the url
*/
$oImage = $oPlaceholder->makePlaceholderFromURL();
// Render image
imagepng($oImage);
Placeholder::DEFAULT_IMAGE_WIDTH
), this should be an integerPlaceholder::DEFAULT_IMAGE_HEIGHT
), this should be an integer also#000
which is black), note that when passing the background color as a
querystring, the #
character in the URL should be omitted#fff
which is white), This represents the color of the textwidth
xheight
Note : Both foreground and Background colors are expected in hex format e.g (#090, #FFFFFF, #F00) without the (#
)
http://path_to_endpoint?w=100&h=150&b=090&f=ffffff&t=Sample+Message+To+Show
Placeholder PHP is implemented using a series of php frameworks, or in other languages, the links are listed below
http://samcrosoft.mit-license.org/