Så tror jeg sgu den var der:
http://www.codebreaker.dk/exp/671214.php?red=75&blue=40Red og Blue er nu procent satser! (skal være mellem 0-100 - ved 0 vises ingen bjælke)
Og koden er her:
<?php
//http://exp.dk/spm/671214
$pic = "671214.jpg";
function LoadJpeg($imgname)
{
$im = @imagecreatefromjpeg($imgname); /* Attempt to open */
if (!$im)
{
/* See if it failed */
$im = imagecreate(150, 30); /* Create a blank image */
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an errmsg */
imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
$redHeight = (is_numeric($_GET['red']) && $_GET['red'] > 0 && $_GET['red'] <= 100)?$_GET['red'] :0;
$blueHeight = (is_numeric($_GET['blue']) && $_GET['blue'] > 0 && $_GET['blue'] <= 100)?$_GET['blue']:0;
header("Content-type: image/jpeg");
list($width, $height, $type, $attr) = getimagesize($pic);
$im = @imagecreate($width, $height) or die("Cannot Initialize new GD image stream");
$im = LoadJpeg($pic);
$lowerRightCornerX = $width - 5;
$lowerRightCornerY = $height - 5;
$barWidth = 15;
$maxHeightPixel = ($height - 10)/100;
if($redHeight>0)
{
$lowerRightCornerX -= $barWidth;
$redHeight *= $maxHeightPixel;
$red_color = imagecolorallocate($im, 255, 0, 0);
imagefilledrectangle ($im, $lowerRightCornerX, $lowerRightCornerY-$redHeight, $lowerRightCornerX+$barWidth, $lowerRightCornerY, $red_color);
}
if($blueHeight>0)
{
$lowerRightCornerX -= $barWidth;
$blueHeight *= $maxHeightPixel;
$blue_color = imagecolorallocate($im, 0, 0, 255);
imagefilledrectangle ($im, $lowerRightCornerX, $lowerRightCornerY-$blueHeight, $lowerRightCornerX+$barWidth, $lowerRightCornerY, $blue_color);
}
imagejpeg($im);
imagedestroy($im);
?>