This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#76 2011-07-20 16:54:59

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

What abot seperate images for tbg main site and offline?


http://i46.tinypic.com/dw7zft.png

Offline

 

#77 2011-07-20 17:08:35

LiquidMetal
Scratcher
Registered: 2011-06-15
Posts: 500+

Re: ITopic: self-updating images and links in posts!

sparks wrote:

I can't make the API display text on the Scratch fora because Scratch won't take text from external sources, only images!

Bad Excuse. You can figure it out.  tongue

Find some text to image generating thing?  And then only the ones that are used will be kept on the site?

Offline

 

#78 2011-07-20 17:19:09

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

LiquidMetal wrote:

sparks wrote:

I can't make the API display text on the Scratch fora because Scratch won't take text from external sources, only images!

Bad Excuse. You can figure it out.  tongue

Find some text to image generating thing?  And then only the ones that are used will be kept on the site?

Done a crude one of those already. Look at the last page!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#79 2011-07-20 17:28:34

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: ITopic: self-updating images and links in posts!

also sparks, typo in the code, should be 'strpos' not 'strrpos' (double r).


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#80 2011-07-20 17:45:11

LiquidMetal
Scratcher
Registered: 2011-06-15
Posts: 500+

Re: ITopic: self-updating images and links in posts!

sparks wrote:

Done a crude one of those already. Look at the last page!

Can't find it, can I have a link?

Also, what if my online picture to link to one place and my offline picture to link to another?

Offline

 

#81 2011-07-20 17:46:00

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

strrpos() is a command. Believe me, if it was a typo the code wouldn't work!

strpos: position of first occurrence of a string working from left to right.
strrpos: position of first occurrence of a string working from right to left.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#82 2011-07-20 17:47:32

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

LiquidMetal wrote:

sparks wrote:

Done a crude one of those already. Look at the last page!

Can't find it, can I have a link?

Also, what if my online picture to link to one place and my offline picture to link to another?

http://scratch.mit.edu/forums/viewtopic.php?pid=840055#p840055

Your online and offline images can be hosted anywhere and don't need to be in the same place.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#83 2011-07-20 17:50:30

wulfmaster
Scratcher
Registered: 2011-04-23
Posts: 500+

Re: ITopic: self-updating images and links in posts!

scimonster wrote:

It's just reading the fora's (that sounds better  neutral ) online list, making it lowercase, and comparing it to the user variables as lowercase, right?

In that instance, it would have been forums.  When a word starts with a vowel, you would have place forums  wink


Social Connections - Bringing communities close together! http://cyberkidscountry.com/ip.php

Offline

 

#84 2011-07-20 17:52:06

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

wulfmaster wrote:

scimonster wrote:

It's just reading the fora's (that sounds better  neutral ) online list, making it lowercase, and comparing it to the user variables as lowercase, right?

In that instance, it would have been forums.  When a word starts with a vowel, you would have place forums  wink

no, it would be forum's as it's belonging to the forum.[/offtopic]

Last edited by sparks (2011-07-20 17:52:23)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#85 2011-07-20 17:53:19

robinp
Scratcher
Registered: 2009-01-29
Posts: 53

Re: ITopic: self-updating images and links in posts!

comp500 wrote:

comp500 wrote:

sparks, here's the generator: http://www.mdn.fm/files/321024_fweoa/apigen.htm If you want to use it, i suggest u host it on blocks.scratchr.org and maybe edit it...

i'll finish it tormorrow if i can cos i g2g now

Try this link!! It those exist! 18.85.28.105


http://blocks.scratchr.org/API.php?user=robinp&action=onlineStatus&online=http://mag.racked.eu/cimage/i57.1/Achievement+get%21/ONLINE!%21/mca.png&offline=http://mag.racked.eu/cimage/i57.1/Achievement+get%21/OFFLINE!%21/mca.png

Offline

 

#86 2011-07-20 17:54:08

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

SeptimusHeap wrote:

What abot seperate images for tbg, main site and offline?


http://i46.tinypic.com/dw7zft.png

Offline

 

#87 2011-07-20 17:56:15

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: ITopic: self-updating images and links in posts!

sparks wrote:

strrpos() is a command. Believe me, if it was a typo the code wouldn't work!

strpos: position of first occurrence of a string working from left to right.
strrpos: position of first occurrence of a string working from right to left.

Ah  big_smile  should have seen that one coming.

Well anyway, thought I'd submit some code to this.

This one finds the users newest friend, the code will need some modification to read stuff from the url vars but anyway it's all commented so you know what to do.

It uses the code from your text to image (it just uses that page to generate it as you hadn't released the code for it yet) it also redirects to the latest friends user page, you'll need to if statement it up, all within your capability I'm sure well anyway here it is:

Code:

//Common Code
$username_from_url = 'RUMCHEERYPOOPOO'; //Stick all the other stuff in I can't be bothered :D
$userpageurl = 'http://scratch.mit.edu/users/' . $username_from_url;
$page = ltrim(file_get_contents($userpageurl));
$startpos = strpos($page, 'rel-1') + 33;
$endpos = strpos($page, '"', $startpos);
$length = $endpos - $startpos;
$refined = substr($page, $startpos, $length);
//**** Displays image of newest friend ****\\
$textimage = 'http://blocks.scratchr.org/API.php?action=text&string=' . $refined;
echo file_get_contents($textimage);
//****  ****\\ You'll need to seperate out with if statements based on the url, but I can't be bothered again
//**** Links to newest friend ****\\
header("Location:http://scratch.mit.edu/users/$refined");
exit();

Edit: just so you know, I tested it and I think it works

Last edited by RUMCHEERYPOOPOO (2011-07-20 18:00:35)


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#88 2011-07-20 18:01:03

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

sep, I answered you eariler  tongue  I said I'll consider it, it's a good idea but I might not going to work on it much tomorrow as I'm a bit nervous about the elections...

Rum, that code looks good though I'll probably use the existing Scratch friends API the ST made to get the friends. Then people will be able to display the n'th friend, rather than end up limited to the latest 5  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#89 2011-07-20 18:02:28

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: ITopic: self-updating images and links in posts!

*shakes fist* (oops looks like I'm not allowed to say [removed]) ready made APIs  big_smile

Last edited by Paddle2See (2011-07-21 05:07:44)


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#90 2011-07-20 18:03:51

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

Right I'm off to sleep now. Be back around 10:00am GMT tomorrow  smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#91 2011-07-20 18:06:42

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: ITopic: self-updating images and links in posts!

So what official APIs exist already?


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#92 2011-07-20 18:08:12

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

sigh  tongue  I should really get some sleep! Take a look here


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#93 2011-07-20 18:09:43

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: ITopic: self-updating images and links in posts!

hehe sorry  smile


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#94 2011-07-20 18:19:04

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

Code:

if($_GET['action'] == 'friends'){
        if($_GET['type'] == 'newest'){
            $page = ltrim(file_get_contents('http://scratch.mit.edu/api/getfriendsbyusername/' . $_GET['user']));
            $count = '0';
            $placeholder = '0';
            while ($count < $_GET['num'] - '1'){
                $placeholder = strpos($page, ':', $placeholder + '1');
                $count ++;
            }
            if($count > 0){
                $placeholder++;
            }
            $endplaceholder = strpos($page, ':', $placeholder + 1);
            if($_GET['return'] == 'image'){
            #echo "<img src = 'http://scratch.mit.edu/static/icons/buddy/" . substr($page, $placeholder, $endplaceholder - $placeholder) . "_sm.png' />"; < this echoes the image rather than the file. For glitch testing.
            echo file_get_contents('http://scratch.mit.edu/static/icons/buddy/' . substr($page, $placeholder, $endplaceholder - $placeholder) . '_sm.png');
        }
            if($_GET['return'] == 'link'){
                $user = $_GET['user'];
                $userguy = substr($page, $placeholder, $endplaceholder - $placeholder);
                echo "<meta http-equiv='REFRESH' content='0;url=http://scratch.mit.edu/api/getuser/" . $userguy .  "'>";
            }
        }
    }

big_smile   big_smile   big_smile

Last edited by SeptimusHeap (2011-07-20 18:22:26)


http://i46.tinypic.com/dw7zft.png

Offline

 

#95 2011-07-20 18:22:41

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: ITopic: self-updating images and links in posts!

:p
what was the edit for?

Last edited by RUMCHEERYPOOPOO (2011-07-20 18:23:25)


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#96 2011-07-20 18:23:44

LiquidMetal
Scratcher
Registered: 2011-06-15
Posts: 500+

Re: ITopic: self-updating images and links in posts!

sparks wrote:

http://scratch.mit.edu/forums/viewtopic.php?pid=840055#p840055

Your online and offline images can be hosted anywhere and don't need to be in the same place.

We want black on nothing, not white on black, but its a good start. Did you ever figure out spaces?

I guess I was unclear there.  What I mean is, for example (though why anyone would do this example I don't know), while I am online, I have a block that says LiquidMetal, linking to my user page, and while I am offline, there is the block library logo, linking to the block library.  How would I do that?

Offline

 

#97 2011-07-20 18:25:41

RUMCHEERYPOOPOO
Scratcher
Registered: 2008-12-23
Posts: 100+

Re: ITopic: self-updating images and links in posts!

you'd have to change the api to do that as you would need it to redirect to different pages depending on the persons online status


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#98 2011-07-20 18:36:13

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

RUMCHEERYPOOPOO wrote:

:p
what was the edit for?

I added the smileys  tongue


Anyway, liquid, stop demanding stuff unless you make it yourself. Sparks is 18. He can manage, he just doesn't have the time...  hmm


EDIT: Can someone test my code?

Last edited by SeptimusHeap (2011-07-20 18:37:04)


http://i46.tinypic.com/dw7zft.png

Offline

 

#99 2011-07-20 20:08:46

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

LiquidMetal wrote:

sparks wrote:

http://scratch.mit.edu/forums/viewtopic.php?pid=840055#p840055

Your online and offline images can be hosted anywhere and don't need to be in the same place.

We want black on nothing, not white on black, but its a good start. Did you ever figure out spaces?

I guess I was unclear there.  What I mean is, for example (though why anyone would do this example I don't know), while I am online, I have a block that says LiquidMetal, linking to my user page, and while I am offline, there is the block library logo, linking to the block library.  How would I do that?

The different links thing is impossible on these forums, unless the scratchteam edited the forums.  As for black on nothing, that should be fairly easy.

I'm trying to figure out how to display any text.  If I can do this, then a LOT is possible  big_smile

Last edited by gbear605 (2011-07-20 20:24:17)


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#100 2011-07-20 20:24:47

SeptimusHeap
Scratcher
Registered: 2010-02-01
Posts: 1000+

Re: ITopic: self-updating images and links in posts!

gbear605 wrote:

LiquidMetal wrote:

sparks wrote:

http://scratch.mit.edu/forums/viewtopic.php?pid=840055#p840055

Your online and offline images can be hosted anywhere and don't need to be in the same place.

We want black on nothing, not white on black, but its a good start. Did you ever figure out spaces?

I guess I was unclear there.  What I mean is, for example (though why anyone would do this example I don't know), while I am online, I have a block that says LiquidMetal, linking to my user page, and while I am offline, there is the block library logo, linking to the block library.  How would I do that?

The different links thing is impossible on these forums, unless the scratchteam edited the forums.  As for black on nothing, that should be fairly easy.

It is possible, look at the newest project link part.



Anyway remind sparks of the code I wrote if he gets on...


http://i46.tinypic.com/dw7zft.png

Offline

 

Board footer