Sunday, 15 August 2010

php - Write the output of a (shoutcast status) script to an image -



php - Write the output of a (shoutcast status) script to an image -

i'm trying write next output of (shoutcast status) script image using gd it's not working. doing wrong?

$string = "/home/test.txt";

using above displays path file not it's content.

output:

psytrance.value 37 breaks.value 8 dubstep.value 6 reggae.value 130 oldskool.value 5 ambient.value 81 test.value <- should ignored! complete.value 267

php:

<?php header ("content-type: image/png"); $string = "/home/test.txt"; // seek changing $font = 4; $width = imagefontwidth($font) * strlen($string) ; $height = imagefontheight($font) ; $im = imagecreatefrompng("/home/banner2.png"); $x = imagesx($im) - $width ; $y = imagesy($im) - $height; $backgroundcolor = imagecolorallocate ($im, 255, 255, 255); $textcolor = imagecolorallocate ($im, 0, 0,0); imagestring ($im, $font, $x, $y, $string, $textcolor); imagepng($im); ?>

the shoutcast status saved in test.txt? have write content of file png.

$content = file_get_contents ($string); [...] $lines = explode("\n", $content); foreach ($lines $line) { if (strstr("test.value", $line) !== false) continue; imagestring ($im, $font, $x, $y, $string, $textcolor); $y += 20; }

php image perl gd shoutcast

No comments:

Post a Comment