Altec Posted May 16, 2009 Share Posted May 16, 2009 I'm trying to write out a simple string onto an image. This is my code: <?php /** * @author Steven * @copyright 2009 */ header('Content-Type: image/png'); /*if((file_exists('cache.png')) && (time() - filemtime('cache.png') <= 120)) { readfile('cache.png'); exit; }*/ $remotefile = '[url=http://ws.audioscrobbler.com/1.0/user/StevenFX/recenttracks.xml%27;]http://ws.audioscrobbler.com/1.0/user/StevenFX/recenttracks.xml';[/url] $localfile = 'StevenFX.xml'; if((!file_exists($localfile)) || (time() - filemtime($localfile) > 120)) { $contents = file_get_contents($remotefile); $fp = fopen($localfile, "w"); fwrite($fp, $contents); fclose($fp); } $xml = @simplexml_load_file($localfile); $src = imagecreatefrompng('[url=http://www.l33tsig.net/sig/1/Tagged.png%27]http://www.l33tsig.net/sig/1/Tagged.png'[/url]); $dest = imagecreatefrompng('./3.png'); imagealphablending($dest, false); imagesavealpha($dest, true); imagecopymerge($dest, $src, 62, 0, 0, 0, 400, 100, 80); $color = imagecolorallocate($dest, 255, 255, 255); $string = 'Last track played: '.$xml->track[0]->name.' by '.$xml->track[0]->artist; imagestring($dest, 1, 62, 130, $string, $color); imagepng($dest, 'cache.png'); readfile('cache.png'); imagedestroy($dest); imagedestroy($src); ?> Everything but imagestring() (line 36) works. I can't figure it out. EDIT: This is what the script does: http://www.phreakyourgeek.com/sig/3.php Quote Link to comment https://forums.phpfreaks.com/topic/158353-solved-imagestring-doesnt-draw-string/ Share on other sites More sharing options...
BobcatM Posted May 16, 2009 Share Posted May 16, 2009 $remotefile = '[url=http://ws.audioscrobbler.com/1.0/user/StevenFX/recenttracks.xml%27;]http://ws.audioscrobbler.com/1.0/user/StevenFX/recenttracks.xml';[/url] $src = imagecreatefrompng('[url=http://www.l33tsig.net/sig/1/Tagged.png%27]http://www.l33tsig.net/sig/1/Tagged.png'[/url]); Don't suppose [/url] not being inside the brackets has anything to do with it? Quote Link to comment https://forums.phpfreaks.com/topic/158353-solved-imagestring-doesnt-draw-string/#findComment-835150 Share on other sites More sharing options...
Altec Posted May 16, 2009 Author Share Posted May 16, 2009 Nah, that's just the forum trying to link it. Quote Link to comment https://forums.phpfreaks.com/topic/158353-solved-imagestring-doesnt-draw-string/#findComment-835153 Share on other sites More sharing options...
Altec Posted May 16, 2009 Author Share Posted May 16, 2009 Ah, my coordinates were off. Quote Link to comment https://forums.phpfreaks.com/topic/158353-solved-imagestring-doesnt-draw-string/#findComment-835156 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.