About Placeholder Images

Generate placeholder images. Generates base64 data uri string.

Category 1Development Tools
Modules that have more to do with assisting development of a site rather than managing its content.
Category 2Markup Generation
Markup modules that are called upon to generate or parse markup (like HTML). Markup modules are most often used on the front-end of a site (rather than admin).
Release StateStable
Should be safe for use in production environments. *
Authorsoma
Module Version0.0.1
Class NamePlaceholderImage
Compatibility2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7
Date AddedOctober 29, 2014
Last UpdatedJuly 20, 2015
Recommended ByNew recommendations may take up to 1 day to appear.

Instructions

This module's files should be placed in /site/modules/PlaceholderImage/
How to install or uninstall modules

README

PlaceholderImage

Use this module in templates to generate placeholder images. It doesn't create a physical image but a base64 data uri string to use as the src of image tag. You can get the base64 code or the complete img tag for convenience.

Example chained call:

$base64 = $modules->PlaceholderImage->width(640)->height(480)->background('DDDDDD')->render();

Then insert the string as the src like:

<img src="<?php echo $base64?>">

Or pass true to render() to get a complete tag

$imgTag = $modules->PlaceholderImage->width(640)->height(480)->render(true);

Or static calls for convenience:

$base64 = PlaceholderImage::image(150,100);
$base64 = PlaceholderImage::image(150, 100, 'FF0000', 'FFFFFF', 'Custom text');
$imgTag = PlaceholderImage::imagetag(150, 100, 'FF0000', 'FFFFFF', 'Custom text');

Requirements:

  • GD PHP lib installed in your server.

Comments

No comments yet. Be the first to post!

Post a Comment

Your e-mail is kept confidential and not included with your comment. Website is optional.