I should think so! Would you like me to give it a go? I have a feeling that it's more or less the same technique.... I can probably get it to echo back your Scratch icon image or an icon of your newest project(s) but I can't see any way of resizing them, I assume you'd want them smaller than they are on your mystuff page?
Offline
sparks wrote:
I should think so! Would you like me to give it a go? I have a feeling that it's more or less the same technique.... I can probably get it to echo back your Scratch icon image or an icon of your newest project(s) but I can't see any way of resizing them, I assume you'd want them smaller than they are on your mystuff page?
Hmm... What's your API's code? I could try myself...
Last edited by SeptimusHeap (2011-07-18 16:58:05)
Offline
The current php code for the API
<?php
$page = ltrim(file_get_contents('http://scratch.mit.edu/forums/index.php'));
$startpos = strrpos ($page, "Online: </strong></dt>");
$endpos = strlen(ltrim(file_get_contents('http://scratch.mit.edu/forums/index.php')));
$refined = substr($page, $startpos, $endpos);
$online = 'http://blocks.scratchr.org/online.gif';
$offline = 'http://blocks.scratchr.org/offline.gif';
if(isset($_GET['type'])){
if($_GET['type'] == 'square'){
$online = 'http://blocks.scratchr.org/onlineSquare.gif';
$offline = 'http://blocks.scratchr.org/offlineSquare.gif';
}
if($_GET['type'] == 'text'){
$online = 'http://blocks.scratchr.org/onlineText.gif';
$offline = 'http://blocks.scratchr.org/offlineText.gif';
}
}
if(!isset($_GET['type'])){
if(isset($_GET['online'])){
$online = $_GET['online'];
}
if(isset($_GET['offline'])){
$offline = $_GET['offline'];
}
}
if(isset($_GET['user'])){
$pos = strrpos($refined, $_GET['user']);
if(strlen($pos < '1')){
echo file_get_contents($offline);
}
if(strlen($pos >= '1')){
echo file_get_contents($online);
}
}
?>Last edited by sparks (2011-07-18 17:48:43)
Offline
sparks wrote:
Sure thing, here's the current code:
Code:
<?php $page = ltrim(file_get_contents('http://scratch.mit.edu/forums/index.php')); $startpos = strrpos ($page, "Online: </strong></dt>"); $endpos = strlen(ltrim(file_get_contents('http://scratch.mit.edu/forums/index.php'))); $refined = substr($page, $startpos, $endpos); $online = 'http://blocks.scratchr.org/online.gif'; $offline = 'http://blocks.scratchr.org/offline.gif'; if(isset($_GET['type'])){ if($_GET['type'] == 'square'){ $online = 'http://blocks.scratchr.org/onlineSquare.gif'; $offline = 'http://blocks.scratchr.org/offlineSquare.gif'; } if($_GET['type'] == 'text'){ $online = 'http://blocks.scratchr.org/onlineText.gif'; $offline = 'http://blocks.scratchr.org/offlineText.gif'; } } if(!isset($_GET['type'])){ if(isset($_GET['online'])){ $online = $_GET['online']; } if(isset($_GET['offline'])){ $offline = $_GET['offline']; } } if(isset($_GET['user'])){ $pos = strrpos($refined, $_GET['user']); if(strlen($pos < '1')){ echo file_get_contents($offline); } if(strlen($pos >= '1')){ echo file_get_contents($online); } } ?>I originally had it echoing an <img> tag but it wan't working so be sure to use the echo file_get_contents() instead!
![]()
Umm...
You can try making it, never mind.
BTW, look at my sig
vvvvvvvvvvvvvvvvvvv
Last edited by SeptimusHeap (2011-07-18 17:11:45)
Offline
Haha, it's php. But surprisingly similar to the Smalltalk way of doing it! What exactly would you like the API to do?
Love it! What's it like when you're offline?
Last edited by sparks (2011-07-18 17:12:09)
Offline
sparks wrote:
Haha, it's php. But surprisingly similar to the Smalltalk way of doing it! What exactly would you like the API to do?
Love it! What's it like when you're offline?
IDK, user pic and newest project.
By the way, the fonts are Andy Bold (Terraria), Minecraft, and Scratch
Last edited by SeptimusHeap (2011-07-18 17:16:33)
Offline
SeptimusHeap wrote:
sparks wrote:
Haha, it's php. But surprisingly similar to the Smalltalk way of doing it! What exactly would you like the API to do?
Love it! What's it like when you're offline?IDK, user pic and newest project.
By the way, the fonts are Andy Bold (Terraria), Minecraft, and Scratch![]()
So, what do you think of my sig/ideas?
Edit: just went offline, it works
Last edited by SeptimusHeap (2011-07-18 17:21:52)
Offline
It's pretty cool! The Scratch API lets you read information off the main Scratch site so a forum API that reads information from the fora (and maybe the site) would be cool! The sign looks... yummy! For some reason I feel it would taste really nice! The graphics are waaay better than my sig
I think using two fonts for septimus looks a little odd though...
You were saying about latest projects as images? Is that all you want me to try or do you have other expansion ideas?
Offline
sparks wrote:
It's pretty cool! The Scratch API lets you read information off the main Scratch site so a forum API that reads information from the fora (and maybe the site) would be cool! The sign looks... yummy! For some reason I feel it would taste really nice! The graphics are waaay better than my sig
I think using two fonts for septimus looks a little odd though...
You were saying about latest projects as images? Is that all you want me to try or do you have other expansion ideas?
I think this works for showing if people are online alltogether
Offline
sparks wrote:
It's pretty cool! The Scratch API lets you read information off the main Scratch site so a forum API that reads information from the fora (and maybe the site) would be cool! The sign looks... yummy! For some reason I feel it would taste really nice! The graphics are waaay better than my sig
I think using two fonts for septimus looks a little odd though...
You were saying about latest projects as images? Is that all you want me to try or do you have other expansion ideas?
Userpic, newest favorite... newest friend?
Offline
sparks wrote:
Yeah, my original use for this was the block library, I think it could be very handy for any thread with a "developers" list on the first post.
Yeah. I'm going to to suggest this get ITopiced.
Offline
SeptimusHeap wrote:
Userpic, newest favorite... newest friend?
The limitation with this API is that if you want it to show on the fora it has to be an image. Therefore it either has to be an image of some predetermined text or it has to be, say, the user image of your newest friend. (I think - it might be possible to insert text with it but the Scratch forums are generally pretty locked when it comes to getting stuff to change in a post...
Offline
SeptimusHeap wrote:
sparks wrote:
Yeah, my original use for this was the block library, I think it could be very handy for any thread with a "developers" list on the first post.
Yeah. I'm going to to suggest this get ITopiced.
That's very kind of you, we'll see how useful I can make this though, currently the API is a little limited
Offline
sparks wrote:
SeptimusHeap wrote:
Userpic, newest favorite... newest friend?
The limitation with this API is that if you want it to show on the fora it has to be an image. Therefore it either has to be an image of some predetermined text or it has to be, say, the user image of your newest friend. (I think - it might be possible to insert text with it but the Scratch forums are generally pretty locked when it comes to getting stuff to change in a post...
Yeah... I don't think that would be too useful anyway.
I wonder, for the newest project/favorite one, if you could set up a php redirect script on a webpage to redierect to your newest project, along with showing an image...
Last edited by SeptimusHeap (2011-07-18 17:31:47)
Offline
Should be possible, it would have to take you to that page first so the redirect would take a second or so, but the existing "newest project" API should be able to supply the redirect link...
Offline
Cool! So, you think you could make it?
And I fixed my sig.
Offline
Cool
How's Panther 1.1 going? It's been a long time... [/Portal2reference]
Offline
Hmmm, no idea! Could you post the images normally here? I'll take a look.
EDIT: if you look at it as a link you can see the error. It looks like it can't find your images.
Last edited by sparks (2011-07-18 18:13:06)
Offline
For user icon you can use [img]http://scratch.mit.edu/static/icons/buddy/USER ID (found on friends list url)_sm.png[/img]
Sparks' current icon: ![]()
(If he changes it, the changes will show.)
Last edited by SeptimusHeap (2011-07-18 18:18:18)
Offline