Так что я делал динамическую подпись с imagecreatepng, API-интерфейс я используюShow Video Count Via JSon
(Предполагается, что имя пользователя является "GOOGLECHROME")
http://gdata.youtube.com/feeds/api/users/googlechrome?v=2&alt=json
Это line показывает мне, что у них есть 289 видео:
{"rel":"http://gdata.youtube.com/schemas/2007#user.uploads","href":"http://gdata.youtube.com/feeds/api/users/googlechrome/uploads?v=2","countHint":289},
Я не уверен, как распечатать его на изображении
Мой код до сих пор.
Синтаксис: domain.com/image.php?channel=googlechrome
yt.png = http://i.imgur.com/OCRWhI6.png
<?php
$channel = $_REQUEST["channel"];
$image = ('yt.png');
$im = imagecreatefrompng($image);
$white = imagecolorallocate($im, 255, 255, 255);
$width = imagesx($im);
$height = imagesy($im);
$font = 2;
$json_output = file_get_contents('http://gdata.youtube.com/feeds/api/users/'.($channel).'?v=2&alt=json');
$json = json_decode($json_output, true);
$username = $json['entry']['yt$username']['$t'];
$view_count = $json['entry']['yt$statistics']['totalUploadViews'];
$sub_count = $json['entry']['yt$statistics']['subscriberCount'];
//$video_count = $json['entry']['DUNNO_YET']['$t'];
$UserName = ("".$username);
imagestring($im, $font, $width-190, $height-59, $UserName, $white);
$viewCount = ("".$view_count);
imagestring($im, $font, $width-190, $height-45, $viewCount, $white);
$subCount = ("".$sub_count);
imagestring($im, $font, $width-190, $height-30, $subCount, $white);
$VideoCount = ("".$video_count);
imagestring($im, $font, $width-190, $height-15, $VideoCount, $white);
//text before counts
$UNAME = ('Username:');
imagestring($im, $font, $width-278, $height-59, $UNAME, $white);
$TOTALVIEWS = ('Total Views: ');
imagestring($im, $font, $width-278, $height-45, $TOTALVIEWS, $white);
$SUBS = ('Subscribers: ');
imagestring($im, $font, $width-278, $height-30, $SUBS, $white);
$TOTALVIDEOS = ('Total Videos: ');
imagestring($im, $font, $width-278, $height-15, $TOTALVIDEOS, $white);
Header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
Любая помощь приветствуется!
Спасибо, Я придерживаюсь 6-го индекса, это было какое-то время AFAIK. Если он изменится, он должен легко редактироваться! – Gav