nic Posted April 12, 2007 Share Posted April 12, 2007 I'm having a weird problem with the Php GD lib image function. This code works perfectly: header("Content-type: image/png"); $im = imagecreatetruecolor(150, 20); $string = strtoupper($_GET['s']) ; $white = imagecolorallocate($im, 255, 255, 255); $color = imagecolorallocate($im, 186, 176, 164); $font = '../../fonts/Optima.suit'; imagefilledrectangle($im, 0, 0, 150, 20, $white); imagettftext($im, 9, 0, 0, 20, $color, $font, $string); imagepng($im); imagedestroy($im); but this gives me a broken link: header("Content-type: image/png"); $string = $_GET['text']; $im = imagecreatefrompng("button.png"); $orange = imagecolorallocate($im, 220, 210, 60); $px = (imagesx($im) - 7.5 * strlen($string)) / 2; imagestring($im, 3, $px, 9, $string, $orange); imagepng($im); imagedestroy($im); The fact that the first example works makes me think required libraries are install fine, but the second example is copied straight out of the Php manual, which can't be wrong.... I'm so confused. Any help here would be appreciated. Thanks nicholas Link to comment https://forums.phpfreaks.com/topic/46742-image-functions/ Share on other sites More sharing options...
Trium918 Posted April 12, 2007 Share Posted April 12, 2007 but the second example is copied straight out of the Php manual, which can't be wrong.... I'm so confused. If it isn't working something must be wrong, right. Link to comment https://forums.phpfreaks.com/topic/46742-image-functions/#findComment-227772 Share on other sites More sharing options...
nic Posted April 12, 2007 Author Share Posted April 12, 2007 That would be the conventional wisdom... but what the problem is is what's stumping me. Link to comment https://forums.phpfreaks.com/topic/46742-image-functions/#findComment-227774 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.