created_at . " GMT"))); // When was last tweet posted? $twitter_text = $data[0]->text; // Last tweet } else { // Otherwise die("Couldn't fetch data"); // Error occurred while fetching, most likely a timeout } echo "Generating new image \n"; //$im = imagecreatetruecolor(560, 72); // Uncomment this and delete the next line to create a blank image $im = imagecreatefrompng("virb.png"); // This creates an image from an existing PNG image $white = imagecolorallocate($im, 173, 173, 173); // Define some colors to use $grey = imagecolorallocate($im, 100, 100, 100); // Color for side the date/time $twitter_text = wordwrap($twitter_text,72); // Because my image is only 560 pixels wide, text can run out of the boundaries and GD library has nothing to remedy that, so this function will wrap the text after 72 characters. This may differ for your image. $font = 'SomeFont.otf'; // Custom font. You may use one of four or five standard fonts, but they're ugly imagefttext($im, 10, 0, 10, 20, $white, $font, $twitter_text, array('linespacing'=>1.7)); // Write out to the image Twitter status with appropriate positioning imagefttext($im, 9, 0, 11, 61, $grey, $font, $twitter_when, array('linespacing'=>1.7)); // Same with date/time of last tweet imagepng($im,"twitter.png"); // Create twitter.png imagedestroy($im); // Free up some memory echo "Everything done! Quitting...\n"; ?>