papaface Posted April 25, 2009 Share Posted April 25, 2009 Hello, I am currently working with the Twitter API. Those of you who are familar with it will know that to update the background image on a given Twitter account, you need the submit the given image to the API in multipart form. This is really confusing me and any help would be appreciated. My code at the moment is: error_reporting(E_ALL); ini_set('display_errors', '1'); ini_set('memory_limit', '1600M'); require("twitter.php"); $twitter = new Twitter("///","////"); // Set the content-type //header('Content-type: image/jpeg'); // Create the image $im = imagecreatefromjpeg("background.jpg"); $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 62, 51, 54); $black = imagecolorallocate($im, 95, 95, 95); // The text to draw // Replace path by your own font path $font = 'MyriadPro-SemiboldSemiExt.otf'; // Add some shadow to the text // Add the text //imagettftext($im, 20, 90, 34, 500, $black, $font, $text); $text = 'Some random text'; /*imagettftext($im, 20, 90, 78, 538, $grey, $font, $text); imagettftext($im, 20, 90, 74, 538, $black, $font, $text);*/ imagettftext($im, 20, 90, 77, 536, $white, $font, $text); imagettftext($im, 20, 90, 74, 538, $black, $font, $text); imagejpeg($im, 'simpletext.jpg'); //echo '<img src="simpletext.jpg" />'; // Using imagepng() results in clearer text compared with imagejpeg() $mime_boundary=md5(time()); $headers .= 'From: My Email <me@company.com>' . "\n"; $headers .= 'MIME-Version: 1.0'. "\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"".$mime_boundary."\"". "\n"; if ($twitter->updateProfileBackgroundImage("simpletext.jpg")) { echo "done"; } else { echo "problem"; } //imagejpeg($im); ?> But this is giving me this error: Fatal error: Uncaught exception 'TwitterException' with message 'Not Implemented' in /twitter.php:1230 Stack trace: #0 /process.php(42): Twitter->updateProfileBackgroundImage('simpletext.jpg') #1 {main} thrown in /twitter.php on line 1230 Any help would be appreciated :'( 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.