aebstract Posted November 24, 2008 Share Posted November 24, 2008 <?php $file = 'image.jpg'; $image = imagecreatefromjpeg($file); list($width, $height) = getimagesize($file); $font = 'arial.ttf'; $size = 8; $title = 'Last played:'; $artist = 'artist name'; $song = 'song name'; $colorHex = '000000'; list($tr, $tg, $tb) = sscanf($colorHex, '%02X%02X%02X'); $textColor = imagecolorallocate($image, $tr, $tg, $tb); imagettftext($image, $size, 0, 4, $height-29, $textColor, $font, trim($title)); imagettftext($image, $size, 0, 4, $height-17, $textColor, $font, trim($song)); imagettftext($image, $size, 0, 4, $height-5, $textColor, $font, trim($artist)); imagejpeg($image, 'image2.jpg', 95); ?> Trying to place text on top of an existing image and create a new image from that. Once I figure out how to reference values from another website, it should be able to update automatically with certain bits of information.. as it changes on that site. Right now it isn't working really at all. Could someone possibly help on this? Quote Link to comment Share on other sites More sharing options...
ShiloVir Posted November 24, 2008 Share Posted November 24, 2008 hows this?: <?php //use existing image as a canvas $myImage = ImageCreateFromPNG ("baseimage.png"); //allocate the color white $white = ImageColorAllocate ($myImage, 255, 255, 255); //draw on the new canvas ImageFilledEllipse($myImage, 100, 70, 20, 20, $white); ImageFilledEllipse($myImage, 175, 70, 20, 20, $white); ImageFilledEllipse($myImage, 250, 70, 20, 20, $white); //output the image to the browser header ("Content-type: image/png"); ImagePNG($myImage); //clean up after yourself ImageDestroy($myImage); ?> Quote Link to comment Share on other sites More sharing options...
aebstract Posted November 24, 2008 Author Share Posted November 24, 2008 Didn't do anything :/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.