All pastes #770090 Raw Edit

Untitled

public php v1 · immutable
·published 2007-11-11 22:01 UTC
rendered paste body
<?php// Original by nap// Caching by icez//// INSTALLATION://   mkdir cache//   chmod a+w cacheheader("Content-type: image/png");    define('CACHE_DIR', 'post/');$key = md5($_SERVER['REQUEST_URI']);if (!file_exists(CACHE_DIR.$key.'.png')) {    $string        = stripslashes($_GET['string']);    list($weight, $rgb, $font)    = explode(':',$_GET['typo']);    if($weight > 100) die();    list($r, $g, $b)        = explode(',',$rgb);    $font            = 'font/'.$font.'.ttf';    $argu            = imagettfbbox($weight, 0, $font, $string);    $im                = @imagecreate($argu[2] + 6, ($weight + ($weight * 30 / 42))) or die();    $bg                = imagecolorallocatealpha($im, 255, 255, 255, 127);    $fg                = imagecolorallocate($im, $r, $g, $b);    imagettftext($im, $weight, 0, 2, $weight + 4, $fg, $font, $_GET['string']);    imagepng($im);    imagepng($im, CACHE_DIR.$key.'.png');    imagedestroy($im);} else {    echo file_get_contents(CACHE_DIR.$key.'.png');}?>