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

#376 2011-07-27 13:02:52

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

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

Thanks, LS97  smile


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

Offline

 

#377 2011-07-27 13:03:06

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

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

I completed my like button, I'm not sure how to turn anti-aliasing off on the text though as it looks a little soft, I tried using negative values for the colour of the text like the php docs suggest but that completely ruins it.

look in my sig to see it  smile  \/\/


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#378 2011-07-27 13:08:09

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

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

Great! Did you say you made on for this thread? Also, if you can work out how, try letting people customise the button appearance? So that can be the default but if someone wanted their like button to match their sig or something then they might appreciate being able to choose their own bg image and the text x,y and size?  big_smile


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

Offline

 

#379 2011-07-27 13:10:25

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

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

sparks wrote:

Great! Did you say you made on for this thread? Also, if you can work out how, try letting people customise the button appearance? So that can be the default but if someone wanted their like button to match their sig or something then they might appreciate being able to choose their own bg image and the text x,y and size?  big_smile

haha someone just suggested that on the thread for it  big_smile  So I think I'll add it to the todo list.


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#380 2011-07-27 13:15:57

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

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

Just spotted unlike feature while adding it to the first post of this sig, I love it! Good job, Rum  big_smile  Are you planning to release it as open-source? I'm sure people could learn a lot from the code!

I for one would like to see how the return-redirect takes you back to the same place on a page!

Last edited by sparks (2011-07-27 13:18:54)


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

Offline

 

#381 2011-07-27 13:20:15

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

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

sparks wrote:

Just spotted unlike feature while adding it to the first post of this sig, I love it! Good job, Rum  big_smile  Are you planning to release it as open-source? I'm sure people could learn a lot from the code!

Sparks, have you EVER read the thread on it? I think not, ever since I released it at all I have put the source code on there, maybe you should read the it!

http://scratch.mit.edu/forums/viewtopic.php?id=69732

edit: it doesn't take you back to the same place on the page, at least I don't think so, all it does is take you back to the topic page that you just liked, no matter where you clicked the link  smile  so maybe it's your browser taking you to the right bit of the page.

Last edited by RUMCHEERYPOOPOO (2011-07-27 13:21:46)


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#382 2011-07-27 13:22:02

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

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

Oops! I've not read the first post recently, just followed new posts  tongue


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

Offline

 

#383 2011-07-27 13:29:35

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

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

Nice, rum! Great job!
and sparks, I fixed it. Just make sure the font has a relative php path -- no http!
preferably put it in the same directory. that's what i assmued with the code below:

Code:

<?PHP
//parser in spaces
$count = 1;
$string = str_replace("_"," ",$_GET['string']);
if(isset($_GET['bgimage']) && strstr($_GET['bgimage'], ".png")){ #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'];
        $text_colour = imagecolorallocate($img, $red, $blue, $green);
    }
    else{
        $text_colour = imagecolorallocate($img, 0, 0, 0);
    }
    
    // get the font
    $font = realpath('Trebuchet_MS.ttf');
    
    // print the string
    imagettftext($img, 13, 0, 5, 20, $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);

?>

Hope it works...

Last edited by LS97 (2011-07-27 13:33:36)

Offline

 

#384 2011-07-27 13:32:22

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

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

Offline

 

#385 2011-07-27 13:36:07

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

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

LS97 wrote:

Just to prove it, try this:
http://mod-share.webuda.com/imgs/posts/ … ;string=hi

http://mod-share.webuda.com/imgs/posts/postCount.php?bgimage=http://scratch.mit.edu/static/icons/buddy/_med.png&amp;string=new+user+;P

Last edited by scimonster (2011-07-28 04:35:23)

Offline

 

#386 2011-07-27 13:51:10

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

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

Cheers! Will implement in just a moment  smile


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

Offline

 

#387 2011-07-28 04:35:04

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

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

What's an "I=Topic"?  tongue
And we have 16 pages in 9 days?  yikes

Offline

 

#388 2011-07-28 04:35:46

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

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

scimonster wrote:

What's an "I=Topic"?  tongue
And we have 16 pages in 9 days?  yikes

I wondered that...  big_smile


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#389 2011-07-28 04:40:16

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

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

fixed, you picky, picky people  lol


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

Offline

 

#390 2011-07-28 04:50:43

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

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

In newest project links, you put the [img] tag instead of [url].

Offline

 

#391 2011-07-28 05:04:42

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

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

You also forgot to put in the bbcode on quite a few of the examples

We're just trying to make your topic better!


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#392 2011-07-28 05:06:24

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

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

Yeah, I know, I was joking  tongue

aaaaaaand:

http://blocks.scratchr.org/textrender.php?string=You%27d_better_believe_this_works_now!&amp;bgimage=http://www.wastepapersolutions.co.uk/ESW/Images/bluesquare.png&amp;xpos=15&amp;ypos=150

Code:

[img]http://blocks.scratchr.org/textrender.php?string=You%27d_better_believe_this_works_now!&bgimage=http://www.wastepapersolutions.co.uk/ESW/Images/bluesquare.png&xpos=15&ypos=150[/img]

Last edited by sparks (2011-07-28 05:06:55)


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

Offline

 

#393 2011-07-28 05:07:18

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

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

sparks wrote:

Yeah, I know, I was joking  tongue

aaaaaaand:

http://blocks.scratchr.org/textrender.p … p;ypos=150

Nice! has comp's API helper caught up with (y)our progress?

Offline

 

#394 2011-07-28 05:13:10

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

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

RUMCHEERYPOOPOO wrote:

I completed my like button, I'm not sure how to turn anti-aliasing off on the text though as it looks a little soft, I tried using negative values for the colour of the text like the php docs suggest but that completely ruins it.

look in my sig to see it  smile  \/\/

^^Read this please LS97  smile


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#395 2011-07-28 05:14:43

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

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

I don't think so, no, I've not seen him in a while!

Thanks so much for the help with that bgimage, it was slowly killing me  tongue  It does not take different font sizes that I can tell but all the other parts of it are as customiseable as the non-image one  smile


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

Offline

 

#396 2011-07-28 05:16:50

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

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

sparks wrote:

I don't think so, no, I've not seen him in a while!

Thanks so much for the help with that bgimage, it was slowly killing me  tongue  It does not take different font sizes that I can tell but all the other parts of it are as customiseable as the non-image one  smile

I think I'll take a look to see how far hes got and then try and finish it up  smile


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#397 2011-07-28 05:18:49

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

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

Well as far as I'm aware, the most recent one is the downloadable one in post #2...


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

Offline

 

#398 2011-07-28 05:44:17

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

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

sparks wrote:

Well as far as I'm aware, the most recent one is the downloadable one in post #2...

Lol no offence to him but the code is a nightmare, I think I'll have to redo it at some point, although that is an outsiders opinion, I'm sure he understands it perfectly. It's just that some of the code needs changing completely.


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

#399 2011-07-28 05:55:53

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

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

A lot of programmers are self-taught so they just do what works. It's like when johnnydean1 would get a block to work using about 50 lines and then it turns out nXIII knew a commands to do exactly that and cut it down to three. You could always try and develop your own generator if you wanted to have a go?


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

Offline

 

#400 2011-07-28 05:57:47

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

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

sparks wrote:

A lot of programmers are self-taught so they just do what works. It's like when johnnydean1 would get a block to work using about 50 lines and then it turns out nXIII knew a commands to do exactly that and cut it down to three. You could always try and develop your own generator if you wanted to have a go?

I think I'll wait until I've cut down on the todo list for the like buttons a bit more, as it's quite a big job making a generator for it, and I commend what comp has done.


I AM ROOKWOOD101 NOW! (just so you know)

Offline

 

Board footer