TFD3 Posted July 15, 2007 Share Posted July 15, 2007 I have a URL that displays a background image and text overlay but I was wanting to know if its possible to combine the two and have it show as a image? Here is the image/text overlay site: http://beta.alabamaweather.org/radar/radarimages/fun2.php Thanks, Kenny Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 15, 2007 Share Posted July 15, 2007 I have a URL that displays a background image and text overlay but I was wanting to know if its possible to combine the two and have it show as a image? Here is the image/text overlay site: http://beta.alabamaweather.org/radar/radarimages/fun2.php Thanks, Kenny If you have GDlib installed, you can use: http://ca3.php.net/manual/en/function.imagettftext.php Quote Link to comment Share on other sites More sharing options...
TFD3 Posted July 15, 2007 Author Share Posted July 15, 2007 I have a URL that displays a background image and text overlay but I was wanting to know if its possible to combine the two and have it show as a image? Here is the image/text overlay site: http://beta.alabamaweather.org/radar/radarimages/fun2.php Thanks, Kenny If you have GDlib installed, you can use: http://ca3.php.net/manual/en/function.imagettftext.php Its installed but dont know how to use it really. Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 15, 2007 Share Posted July 15, 2007 That's why I linked to the manual. But I'll be nice this time: <?php header("Content-Type: image/png"); $im = imagecreatefrompng("background.png"); $white = imagecolorallocate($im, 255, 255, 255); imagettftext($im, 12, 0, 10, 15, $white, "times.ttf", date()); imagepng($im); ?> Upload your font ("times.ttf") into the same directory as the script and "background.png". Quote Link to comment Share on other sites More sharing options...
TFD3 Posted July 15, 2007 Author Share Posted July 15, 2007 That's why I linked to the manual. But I'll be nice this time: <?php header("Content-Type: image/png"); $im = imagecreatefrompng("background.png"); $white = imagecolorallocate($im, 255, 255, 255); imagettftext($im, 12, 0, 10, 15, $white, "times.ttf", date()); imagepng($im); ?> Upload your font ("times.ttf") into the same directory as the script and "background.png". this is what I get... http://beta.alabamaweather.org/radar/radarimages/fun3.php Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 15, 2007 Share Posted July 15, 2007 I see this in the headers: Content-Type: text/html Should be "image/png" I edited the code I posted earlier, try it again. Quote Link to comment Share on other sites More sharing options...
TFD3 Posted July 15, 2007 Author Share Posted July 15, 2007 I see this in the headers: Content-Type: text/html Should be "image/png" I edited the code I posted earlier, try it again. works...cept the text. Here is what I have: <?php header("Content-Type: image/png"); $txt = testing; $im = imagecreatefrompng("http://beta.alabamaweather.org/radar/radarimages/background.png"); $white = imagecolorallocate($im, 255, 255, 255); imagettftext($im, 12, 0, 10, 15, $white, "arial.ttf", date('$txt')); imagepng($im); ?> and it displays: when it should say testing Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 15, 2007 Share Posted July 15, 2007 <?php header("Content-Type: image/png"); $txt = "testing"; $im = imagecreatefrompng("http://beta.alabamaweather.org/radar/radarimages/background.png"); $white = imagecolorallocate($im, 255, 255, 255); imagettftext($im, 12, 0, 10, 15, $white, "arial.ttf", $txt); imagepng($im); ?> I don't know why you chose to make "testing" a constant or why you put $txt in date(), but try the code above. Quote Link to comment Share on other sites More sharing options...
TFD3 Posted July 15, 2007 Author Share Posted July 15, 2007 <?php header("Content-Type: image/png"); $txt = "testing"; $im = imagecreatefrompng("http://beta.alabamaweather.org/radar/radarimages/background.png"); $white = imagecolorallocate($im, 255, 255, 255); imagettftext($im, 12, 0, 10, 15, $white, "arial.ttf", $txt); imagepng($im); ?> I don't know why you chose to make "testing" a constant or why you put $txt in date(), but try the code above. have no idea...but it now works...thank you!!!!!!!!!!! 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.