Sunday 15 June 2014

php - Display multiple variables in an image -



php - Display multiple variables in an image -

i'm trying utilize multiple variables string within image generated in php, maintain getting next error:

parse error: syntax error, unexpected '' - '' (t_constant_encapsed_string) in c:\xampp\htdocs\projects\scrobbl.in\image.php on line 36

what doing wrong?

here's code:

<?php $img_number = imagecreate(275,25); $backcolor = imagecolorallocate($img_number,102,102,153); $textcolor = imagecolorallocate($img_number,255,255,255); imagefill($img_number,0,0,$backcolor); imagestring($img_number,10,5,5,$currenttrack' - '$artist,$textcolor); header("content-type: image/jpeg"); imagejpeg($img_number); ?>

this should work you:

imagestring($img_number,10,5,5,"$currenttrack" . " - " . "$artist",$textcolor);

php gd2

No comments:

Post a Comment