Created
July 8, 2013 17:11
-
-
Save pietvanzoen/5950646 to your computer and use it in GitHub Desktop.
Image Placeholders :: Helper functions for placeholder image services such as http://Placehold.it and http://Placekitten.com. #php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://placehold.it | |
function placeholdit($width = 100, $height = '', $text = '', $colors = '') | |
{ | |
$dimentions = $width.( !empty($height) ? 'x'.$height : ''); | |
$text = !empty($text) ? '&text='.urlencode($text) : ''; | |
$colors = !empty($colors) ? explode(' ', $colors) : ''; | |
$colors = !empty($colors) ? '/'.$colors[0].'/'.$colors[1] : ''; | |
return 'http://placehold.it/'.$dimentions.$colors.$text; | |
} | |
// http://placekitten.com | |
function placekitten($width = 100, $height = '', $grey = false) | |
{ | |
$dimentions = $width.( !empty($height) ? '/'.$height : ''); | |
$g = $grey === true ? 'g/' : ''; | |
return 'http://placekitten.com/'.$g.$dimentions; | |
} | |
// http://placecage.com | |
function placecage($width = 100, $height = '', $style = '') | |
{ | |
$dimentions = $width.( !empty($height) ? '/'.$height : ''); | |
$s = (empty($style) ? '' : $style.'/'); | |
return 'http://placecage.com/'.$s.$dimentions; | |
} | |
// http://fillmurray.com | |
function fillmurray($width = 100, $height = '', $style = '') | |
{ | |
$dimentions = $width.( !empty($height) ? '/'.$height : ''); | |
$s = (empty($style) ? '' : $style.'/'); | |
return 'http://fillmurray.com/'.$s.$dimentions; | |
} | |
// http://fillmurray.com | |
function nicenicejpg($width = 100, $height = '', $style = '') | |
{ | |
$dimentions = $width.( !empty($height) ? '/'.$height : ''); | |
$s = (empty($style) ? '' : $style.'/'); | |
return 'http://nicenicejpg.com//'.$s.$dimentions; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment