This thread is closed and the information below is outdated, please don't use it. Instead, the newer version can be found here!
________________________________________________________________________________
Hello everyone! I've just finished building a little API page which returns either one image or another depending on whether of not the requested Scratch user is online on the forums! I couldn't find any API that did this so decided to make it myself!
________________________________________________________________________________
This API is open source! Click here to see the current API code!
________________________________________________________________________________
parameters: user, optional(type, online, offline)
the API is case sensitive to all parameters
________________________________________________________________________________
Standard image
For this type you need only give the Scratcher name. This will either show a
or a
. For example: I am currently .
[img]http://blocks.scratchr.org/libstatus.php?user=user[/img]
________________________________________________________________________________
The type attribute
The "type" attribute can be set to change the appearance of the image returned. setting type to square gives you
and
. Setting it to "text" will give you the text
and
(they're still images).For example: I am currently
[img]http://blocks.scratchr.org/libstatus.php?user=user&type=type[/img]
________________________________________________________________________________
The link attributes
These two attributes allow you to link your own images through the API. You can use it to make a signature that appears different when you are offline to online, for example!
[img]http://blocks.scratchr.org/libstatus.php?user=sparks&online=onlineimagelink&offline=offlineimagelink[/img]
This takes two image you like, hosted anywhere on the internet as a supported image type. For example I could take this:
and this:
to get this:
Sparks.
________________________________________________________________________________
Planned updates
User image display grabs image from their my stuff page.
Latest project(s) thumbnail display.
redirect to latest project(s) page.
Please suggest other ideas.
Thanks to MathWizz for help getting the images to display in a post!
Last edited by sparks (2011-07-20 09:47:03)
Offline
Its kinda pointless but still cool and it can be used in your signature to judge if your online or not.
Offline
dav09 wrote:
Its kinda pointless but still cool and it can be used in your signature to judge if your online or not.
![]()
Yup, I was aiming for use either in sigs or on collab threads where the circle could appear next to each listed developers' name
Offline
dav09 wrote:
Its kinda pointless but still cool and it can be used in your signature to judge if your online or not.
![]()
why would you need to put that in a sig when it already says if ur online/offline.
Offline
nathanprocks wrote:
dav09 wrote:
Its kinda pointless but still cool and it can be used in your signature to judge if your online or not.
![]()
why would you need to put that in a sig when it already says if ur online/offline.
To make it more apparent? You could also put it in your sig for other people, say people you interact with regularly to see quickly if they're online
Offline
ssss wrote:
It doesn't work
![]()
Right click and control click on "View Image". It should show there, but not embedded.
I think that's because the source of the page embeds the image, rather than drawing it.
Offline
scimonster wrote:
ssss wrote:
It doesn't work
http://blocks.scratchr.org/libstatus.php?user=ssss
Right click and control click on "View Image". It should show there, but not embedded.
I think that's because the source of the page embeds the image, rather than drawing it.
Yeah, how do you fix that?
Offline
Well if you view the page it works, just doesn't show it in your sig.
Offline
I did say in the first post that it doesn't work... the thing is it USED to. Pages containing only images were displayed as images on the fora, daffy22's changing sig was an example of that...
Offline
Try this code:
<?php
header('content-type: image/gif');
$fora = file_get_contents('http://scratch.mit.edu/forums/index.php');
$page = ltrim($fora);
$startpos = strrpos ($page, "Online: </strong></dt>");
$endpos = strlen(ltrim($fora));
$refined = substr($page, $startpos, $endpos);
if(isset($_GET['user'])){
$pos = strrpos($refined, $_GET['user']);
if(strlen($pos < '1'))
echo file_get_contents('http://blocks.scratchr.org/offline.gif');
else
echo file_get_contents('http://blocks.scratchr.org/online.gif');
}
?>Offline
sparks wrote:
It works! I am currently http://blocks.scratchr.org/libstatus.php?user=sparks
Cool! I'm
It's case sensitive though.
Offline
Added to my sig. Woot!
What kind of options?
Offline
What does the page say when you go there?
Offline
The first post now documents the API fully, allowing status to be shown using a circle or square image, the text "online" or "offline" or even an image of choice hosted anywhere on the internet!
Offline
Could you by any chance use this same idea to make...
Signatures that would show your current icon
Your newest project (using RSS maybe?)
..etc?
Offline