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

#351 2011-07-26 08:33:13

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

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

I've finished! http://scratch.mit.edu/forums/viewtopic.php?id=69732

Any suggestions are welcome


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#352 2011-07-26 08:49:43

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

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

Sooo, I haven't followed this topic. What's been happening?


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

Offline

 

#353 2011-07-26 12:23:16

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

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

I've made a like button for this topic and I liked it  smile

http://scratchloveit.netne.net/topicrate.php?id=69113&ret=image


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#354 2011-07-26 16:33:05

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

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

This useful resource has now been ITopic'd, immortalized through a sticky!

Thanks so much, Sparks, for creating such amazing guides.

Offline

 

#355 2011-07-26 16:34:44

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

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

Awesome!


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#356 2011-07-26 16:35:59

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

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

Thanks coolstuff! It's a great honour to have a I-Topic in my name and I hope I can continue developing this!!! What's going on about that laman's guide? Am I writing that or are one of your mods working on one for FAQ?


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

Offline

 

#357 2011-07-26 19:50:08

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

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

SeptimusHeap wrote:

Sooo, I haven't followed this topic. What's been happening?


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

Offline

 

#358 2011-07-26 19:55:36

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

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

SeptimusHeap wrote:

Sooo, I haven't followed this topic. What's been happening?

Well, the topic has been i-topic'd, sparks has added full text rendering with many customiseable options.


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#359 2011-07-27 04:55:55

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

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

I'm wondering comp500 how much of the api you've put into the generator, so I can start with putting more things in


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#360 2011-07-27 05:30:26

whizzer
Scratcher
Registered: 2008-05-27
Posts: 500+

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

I've just kitted out my TBG The 3DS Championships with the online/offline indicators. If the user is online, the 3DS image is open and black, if their offline, it's closed and blue. It works really well!

And in case anyone wants to know, I suggested this to be ITopic'd.


http://i46.tinypic.com/33df6me.png I'm whizzer0 for all things Minecraft.

Offline

 

#361 2011-07-27 05:45:50

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

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

Hey Whizzer, that's pretty cool! It's good to get confirmation that it works in TBG  smile


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

Offline

 

#362 2011-07-27 05:47:05

whizzer
Scratcher
Registered: 2008-05-27
Posts: 500+

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

Another example of the API is here: http://scratch.mit.edu/forums/viewtopic … 32&p=1


http://i46.tinypic.com/33df6me.png I'm whizzer0 for all things Minecraft.

Offline

 

#363 2011-07-27 05:50:43

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

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

Yes, I saw, that's not the API though. API stands for application program interface and from what I understand about it, it does not store information. Rum's like button system is something he's been working on seperately  smile


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

Offline

 

#364 2011-07-27 06:06:31

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

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

sparks wrote:

Yes, I saw, that's not the API though. API stands for application program interface and from what I understand about it, it does not store information. Rum's like button system is something he's been working on seperately  smile

Yeh it's not an api as it doesn't get any information from the scratch forums at all other than it checks a few things to make sure a page exists there.


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#365 2011-07-27 08:15:43

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

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

sparks wrote:

Hmmm, I can't find anywhere on the fora or the Scratch API that shows the number of posts of each user... The way it's looking the post counter would need the user name and a link to a page on which they have posted... Anyone seen anywhere that shows the number of person (n)'s posts other than beside the posts?

Well, you could use the search page to look for a post by them, then get the number of posts from there...

Offline

 

#366 2011-07-27 09:38:55

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

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

RUMCH's system works really well -- all it needs IMO is a slight graphic improvement.
Coming soon, it's going to take a slight while.

Offline

 

#367 2011-07-27 09:40:57

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

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

scimonster wrote:

sparks wrote:

Hmmm, I can't find anywhere on the fora or the Scratch API that shows the number of posts of each user... The way it's looking the post counter would need the user name and a link to a page on which they have posted... Anyone seen anywhere that shows the number of person (n)'s posts other than beside the posts?

Well, you could use the search page to look for a post by them, then get the number of posts from there...

A bit of a hard workaround, but maybe possible. There must be something easier, maybe ask the user to link a post...

Offline

 

#368 2011-07-27 09:59:57

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

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

OK, here's my graphical improvement to RUMCHEE's +1/Like thing:
http://mod-share.webuda.com/imgs/posts/likesEX.php

Obviously that's my post count and not a like button (I wish). Anyway, if you like the concept I can give you the source for creating the image as it is there.

Offline

 

#369 2011-07-27 10:39:29

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

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

I can see improvements to be made to the background but source would be appreciated to modify, I'm assuming that it uses a separate picture for the background? Because if so I will change it as I feel it could be slightly better (only slightly, still better than the current one  wink  )

Last edited by RUMCHEERYPOOPOO (2011-07-27 10:49:51)


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#370 2011-07-27 11:05:12

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

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

RUMCHEERYPOOPOO wrote:

I can see improvements to be made to the background but source would be appreciated to modify, I'm assuming that it uses a separate picture for the background? Because if so I will change it as I feel it could be slightly better (only slightly, still better than the current one  wink  )

Sure!
Image:
http://mod-share.webuda.com/imgs/posts/postLikeCntB.png

PHP Code just for image + text (add a $text = number of likes)

// add background image and set gray font color
$img = imagecreatefrompng ( "postLikeCntB.png" );
$text_colour = imagecolorallocate( $img, 210, 210, 210 );

// add text
$font = realpath('font.ttf');
imagettftext($img, 13, 0, 28, 24, $text_colour, $font, '+' . $text);

// this isneeded to remove background,
// maybe something neater = better but had no time to try
$whit = imagecolorallocate($img, 255, 255, 255);
imagecolortransparent($img, $whit);

// set content + create image
header( 'Content-type: image/png' );
imagepng( $img );

//destroy resources
imagecolordeallocate( $text_color );
imagedestroy( $img );

I just realized I completely disregarded the unlike button -- maybe make it a plus to like, and a minus to unlike?
so, 20 likes:  < (+20)
when liked:  < (-20)

it's just an idea.

(on a sidenote, http://scratchloveit.netne.net/topicrate.php?id=849226&amp;ret=image) -.-

Last edited by LS97 (2011-07-27 11:10:56)

Offline

 

#371 2011-07-27 11:41:19

videogame9
Scratcher
Registered: 2008-05-12
Posts: 1000+

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

Testing the indicator...

http://blocks.scratchr.org/API.php?user=videogame9&amp;action=onlineStatus  http://blocks.scratchr.org/API.php?user=videogame9&amp;action=onlineStatus&amp;type=text

It worked!

This is pretty cool. I like this.

Last edited by videogame9 (2011-07-27 11:46:52)


http://img641.imageshack.us/img641/4118/newvg9logo.png
QUOTE OF THE RIGHT NOW: why are we arguing about dead babies? -videogame9

Offline

 

#372 2011-07-27 12:09:23

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

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

LS97 wrote:

RUMCHEERYPOOPOO wrote:

I can see improvements to be made to the background but source would be appreciated to modify, I'm assuming that it uses a separate picture for the background? Because if so I will change it as I feel it could be slightly better (only slightly, still better than the current one  wink  )

Sure!
Image:
http://mod-share.webuda.com/imgs/posts/postLikeCntB.png

PHP Code just for image + text (add a $text = number of likes)

// add background image and set gray font color
$img = imagecreatefrompng ( "postLikeCntB.png" );
$text_colour = imagecolorallocate( $img, 210, 210, 210 );

// add text
$font = realpath('font.ttf');
imagettftext($img, 13, 0, 28, 24, $text_colour, $font, '+' . $text);

// this isneeded to remove background,
// maybe something neater = better but had no time to try
$whit = imagecolorallocate($img, 255, 255, 255);
imagecolortransparent($img, $whit);

// set content + create image
header( 'Content-type: image/png' );
imagepng( $img );

//destroy resources
imagecolordeallocate( $text_color );
imagedestroy( $img );

I just realized I completely disregarded the unlike button -- maybe make it a plus to like, and a minus to unlike?
so, 20 likes:  < (+20)
when liked:  < (-20)

it's just an idea.

(on a sidenote, http://scratchloveit.netne.net/topicrat … ;ret=image) -.-

Regarding your sidenote, this doesn't work because you tried adding a like button about a post, it only works for topics  smile  (the things that show on the advanced forums list).

Edit: Thanks for the code by the way, I'm changing the picture to give it a more 'scratchy' feel!

Last edited by RUMCHEERYPOOPOO (2011-07-27 12:16:45)


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#373 2011-07-27 12:30:53

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

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

RUMCHEERYPOOPOO wrote:

LS97 wrote:

RUMCHEERYPOOPOO wrote:

I can see improvements to be made to the background but source would be appreciated to modify, I'm assuming that it uses a separate picture for the background? Because if so I will change it as I feel it could be slightly better (only slightly, still better than the current one  wink  )

Sure!
Image:
http://mod-share.webuda.com/imgs/posts/postLikeCntB.png

PHP Code just for image + text (add a $text = number of likes)

// add background image and set gray font color
$img = imagecreatefrompng ( "postLikeCntB.png" );
$text_colour = imagecolorallocate( $img, 210, 210, 210 );

// add text
$font = realpath('font.ttf');
imagettftext($img, 13, 0, 28, 24, $text_colour, $font, '+' . $text);

// this isneeded to remove background,
// maybe something neater = better but had no time to try
$whit = imagecolorallocate($img, 255, 255, 255);
imagecolortransparent($img, $whit);

// set content + create image
header( 'Content-type: image/png' );
imagepng( $img );

//destroy resources
imagecolordeallocate( $text_color );
imagedestroy( $img );

I just realized I completely disregarded the unlike button -- maybe make it a plus to like, and a minus to unlike?
so, 20 likes:  < (+20)
when liked:  < (-20)

it's just an idea.

(on a sidenote, http://scratchloveit.netne.net/topicrat … ;ret=image) -.-

Regarding your sidenote, this doesn't work because you tried adding a like button about a post, it only works for topics  smile  (the things that show on the advanced forums list).

Edit: Thanks for the code by the way, I'm changing the picture to give it a more 'scratchy' feel!

ok great!!

Offline

 

#374 2011-07-27 12:40:23

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

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

Oh, LS97, I've sofar failed to get the bgimage version working  sad  can you see what's wrong?:

Code:

<?PHP
//parser in spaces
$count = 1;
$string = str_replace("_"," ",$_GET['string']);
if(isset($_GET['bgimage'])){ #thanks to LS97 for making most of the bgimage attribute!
    // create the background
    $img = imagecreatefrompng($_GET['bgimage']);
    
    //chooses the text color
        if(isset($_GET['textr']) | isset($_GET['textg']) | isset($_GET['textb'])){
        $red = (int)$_GET['textr'];
        $green = (int)$_GET['textg'];
        $blue = (int)$_GET['textb'];
        $color = imagecolorallocate($img, $red, $blue, $green);
    }
    else{
        $text_colour = imagecolorallocate($img, 0, 0, 0);
    }
    
    // get the font -- it's a truetype font, you probably need that as opposed to a bitmap font
    $font = realpath('http://www.blocks.scratchr.org/fonts/Trebuchet_MS.ttf');
    
    // print the string
    imagettftext($img, 13, 0, 15, 35, $text_colour, $font, $string);
    
    // tell browser about content type
    header( 'Content-type: image/png' );
    // create image
    imagepng( $img );
}
if(!isset($_GET['bgimage'])){
    // Set font size
    $font_size = 2;
    if(isset($_GET['font_size'])){
        $font_size = $_GET['font_size'];
    }
    $font = '/fonts/Trebuchet_MS.ttf';
    if(isset($_GET['font'])){
        $font = $_GET['font'];
    }
    // Create image width dependant on width of the string
    $width  = imagefontwidth($font_size)*strlen($string);
    if(isset($_GET['width'])){
        $width = $_GET['width'];
    }
    // Set height to that of the font
    $height = imagefontheight($font_size);
    if(isset($_GET['height'])){
        $height = $_GET['height'];
    }
    // Create the image pallette
        $img = imagecreate($width,$height);
        if(isset($_GET['bgr']) | isset($_GET['bgg']) | isset($_GET['bgb'])){
            $red = (int)$_GET['bgr'];
            $blue = (int)$_GET['bgg'];
            $green = (int)$_GET['bgb'];
            $bg    = imagecolorallocate($img, $red, $blue, $green);
        }
        else{
            $bg    = imagecolorallocate($img, 222, 223, 223);
        }
    // Font color
    if(isset($_GET['textr']) | isset($_GET['textg']) | isset($_GET['textb'])){
        $red = (int)$_GET['textr'];
        $green = (int)$_GET['textg'];
        $blue = (int)$_GET['textb'];
        $color = imagecolorallocate($img, $red, $blue, $green);
    }
    else{
        $color = imagecolorallocate($img, 0, 0, 0);
    }

    // Length of the string
    if(isset($_GET['limitstring'])){
        if(strlen($string) > $_GET['limitstring']){
            $string= substr($string, 0, $_GET['limitstring']);
        }
    }
    $len = strlen($string);
    // Y-coordinate of character, X changes, Y is static
    $ypos = 0;
    if(isset($_GET['ypos'])){
        $ypos = $_GET['ypos'];
    }
    // Loop through the string
    for($i=0;$i<$len;$i++){
        // Position of the character horizontally
        if(isset($_GET['xpos'])){
            $xpos = $i * imagefontwidth($font_size) + $_GET['xpos'];
        }
        else{
            $xpos = $i * imagefontwidth($font_size);
        }
        // Draw character
        imagechar($img, $font_size, $xpos, $ypos, $string, $color);
        // Remove character from string
        $string = substr($string, 1);   
    
    }
    // Return the image
    header("Content-Type: image/gif");
    imagegif($img);
}
// Remove image
imagedestroy($img);

?>

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

Offline

 

#375 2011-07-27 12:51:15

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

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

^^ I'll do my best! Expect an answer within the following 15/20 minutes, if i don't reach my 200mb limit before that.

EDIT
good, 70MB left. and as for the problem, found out that the path given to images is not a valid one. let me try to fix that (it's the only error, the other 4 are all depending on it)

Last edited by LS97 (2011-07-27 13:02:28)

Offline

 

Board footer