Create images on the fly
<?php
header("Content-type: image/png");
$image = imagecreatefrompng("bubble3.png");
$price = (int)$_GET['price'];
$font = 'arialbd.ttf';
$fontsize = 8;
$color = imagecolorallocate($image,255,255,255);
$px_top = 16;
switch(true) {
case ($price > 0 && $price <= 5000): // $price returns 0 if string is passed
$f_price = "< 5K";
break;
case (($price > 5000) && ($price < 1000000)):
$f_price = round(($price/1000),1).'K';
break;
case ($price >= 1000000):
$f_price = round(($price/1000000), 1).'M';
break;
default:
$f_price = '---';
}
$px_center = (imagesx($image) - 5.5 * strlen($f_price)) / 2;
imagettftext($image, $fontsize, 0, $px_center, $px_top, $color, $font, $f_price);
imagealphablending($image, false);
imagesavealpha($image, true);
imagepng($image);
imagedestroy($image);
// Usage: <img src="getpriceimage.php?price=10000" />