Pertama tambahkan file tmhOAuth.php di dalam folder /common, dan file tmhOAuth.php bisa di dapat di sini
kemudian masuk ke file common/twitter.php
tambahkan code di bawah ini di menu register
‘avatar’ => array(
‘hidden’ => true,
‘security’ => true,
‘callback’ => ‘twitter_avatar_page’,
),
masih di dalam file yang sama tambahkan fungsi di bawah ini
function twitter_avatar_page($query) {
if ( ! empty($_FILES)) {
require ‘tmhOAuth.php’;
list($oauth_token, $oauth_token_secret) = explode(‘|’, $GLOBALS['user']['password']);
$tmhOAuth = new tmhOAuth(array(
‘consumer_key’ => OAUTH_CONSUMER_KEY,
‘consumer_secret’ => OAUTH_CONSUMER_SECRET,
‘user_token’ => $oauth_token,
‘user_secret’ => $oauth_token_secret,
));// note the type and filename are set here as well
$params = array(
‘image’ => "@{$_FILES['image']['tmp_name']};type={$_FILES['image']['type']};filename={$_FILES['image']['name']}",
);// if we are setting the background we want it to be displayed
$code = $tmhOAuth->request(‘POST’, $tmhOAuth->url("1/account/update_profile_image"),
$params,
true, // use auth
true // multipart
);if ($code == 200) {
$json = json_decode($tmhOAuth->response['response']);$text = $json->text;
$content = "<span class=’status shift’><font color=’green’>You’ve success to upload a photo profile.</font></span>";} else {
$content = "<span class=’status shift’><font color=’red’>Damn! Something went wrong. Sorry</font></span>";
}
}if($_POST) {
if (!$_FILES['image']['tmp_name']) {
$content .= "<span class=’status shift’><font color=’red’>Please select an image to upload.</font></span>";
}
}$user = twitter_user_info(user_current_username());
$content .= theme(‘user_header’, $user);
$content .= "<form method=’post’ action=’avatar’ enctype=’multipart/form-data’><div>
Upload your avatar<br/>
<input type=’file’ name=’image’ /><br/>
<button type=’submit’ class=’button’>Upload</button></div></form>";return theme(‘page’, ‘Upload Avatar’, $content);
}
selesai, semoga berhasil
Jangan lupa kunjungi & gunakan Twitter Client dari kami di alamat www.imorv.com
Filed under: Dabr, Twitter Ditandai: | Dabr, Mobile Twitter Client, Twitter, Twitter Client, Upload Avatar
Gan, ane nyoba tutorial yang autotext, kok pas update status muncul pesan error yah???
Di update lagi dong..
Thanks
aku minta script yang ente pake dong gan , ntar biar ane gag kesusahan , makasih sent email ya gan
Mantap…
Kang ane boleh minta scrip drbi yg lg situ pake ga ?
Ane buat gagal teruz.