Stab
Junior Member
MSN Sphere Creator.
Posts: 27
41 / / –
Joined: Jul 2005
|
RE: Web2Messenger Background Script!
code: <?php
//no error report because we whant an image so we don't need text in !!!
error_reporting(0);
// variables
// width of backgound image
$width = 468;
// height of background image
$height = 60;
// background path
$bgpng = "./images/bg.png";
// w2m image path
$w2mpng = "http://www.web2messenger.com/status/YOURNAME.png";
// create a new image and add colours
// create the image
$im = imagecreatetruecolor($width, $height);
// colour white
$white = imagecolorallocate($im, 254, 253, 254);
// border colour (grey)
$bordercolour = imagecolorallocate($im, 182, 182, 182);
// fill bg white
imagefill($im, 0, 0, $white);
// if you background image has rounded curves use this
imagecolortransparent($im, $white);
// open bg image
$bg = imagecreatefrompng($bgpng);
// copy bg image onto first image
imagecopy($im, $bg, 0, 0, 0, 0, $width, $height);
// close this image
imagedestroy($bg);
// open our w2m image
if (getimagesize($w2mpng)){
$w2m = imagecreatefrompng($w2mpng);
//get w2m image width
$w2mwidth = imagesx($w2m);
//get w2m image height
$w2mheight = imagesy($w2m);
// your status image
ImageCopy($im, $w2m, 8, 13, 0, 0, 40, $w2mheight-12);
//your personal message
$w2mwidth = $w2mwidth-42;
if ($w2mwidth>330) {
$w2mwidth = 330;
}
ImageCopy($im, $w2m, 72, 40, 42, 15, $w2mwidth, $w2mheight-33);
// close this image
imagedestroy($w2m);
}
//if w2m is not an image the service is down...
else{
$black = imagecolorallocate($im, 0, 0, 0);
// the error text
$text = 'Status service down...';
// your police (need to upload one)
$font = 'LUCON.TTF';
// add the text
imagettftext($im, 8, 0, 75, 55, $black, $font, $text);
$offpng = "./images/off.png"; //the status failed image
$w2m = imagecreatefrompng($offpng);
ImageCopy($im, $w2m, 18, 24, 0, 0, 21, 21);
imagedestroy($w2m);
}
// finished now just make the image a PNG and show it
header("Content-Type: image/png");
imagepng($im);
imagedestroy($im);
?>
Thanks hmaster for the orginal code
Just because server crash I add a little condition in the script.
Enjoy...
This post was edited on 08-26-2005 at 12:51 PM by Stab.
Sorry, if my English is not as good as I would like...
MSN Sphere
|
|