Skip to content

Instantly share code, notes, and snippets.

@tobsn
Created May 6, 2011
Embed
What would you like to do?
one transparent or colored gif pixel
<?php
header( 'Content-type: image/gif' );
header( 'Expires: Wed, 11 Nov 1998 11:11:11 GMT' );
header( 'Cache-Control: no-cache' );
header( 'Cache-Control: must-revalidate' );
if( !empty( $_GET['c'] ) ) {
$rgb = preg_replace( '/[^0-9a-z]/i', '', $_GET['c'] );
die( sprintf(
'%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c',
71,73,70,56,57,97,1,0,1,0,128,0,0,
hexdec( substr ( $rgb, 0, 2 ) ),
hexdec( substr ( $rgb, 2, 2 ) ),
hexdec( substr ( $rgb, 4, 2 ) ),
0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59
) );
}
else {
die( sprintf( '%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%',71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59 ) );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment