RE: Re: PHP Brain Teasers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A ticket, a tasket, a red and yellow basket

-----Original Message-----
From: Jochem Maas [mailto:jochem@xxxxxxxxxxxxx] 
Sent: Friday, July 06, 2007 2:59 AM
To: Daniel Brown
Cc: Larry Garfield; php-general@xxxxxxxxxxxxx
Subject: Re:  Re: PHP Brain Teasers

Daniel Brown wrote:
>    Let's get obscure.... try to guess it before running the code.  It
> actually shouldn't be difficult.

I tried to figure it out - I couldn't, I ran the code and I still don't
get it. oh well :-)

> 
> <?
> 
> class Brainteaser {
>    function
> paint($original_image,$rgb_string1,$rgb_string2,$input1,$input2) {
>        header("Content-type: image/png");
>        $im = imagecreatefromjpeg($original_image);
>        $rgb1 = explode(',',$rgb_string1);
>        $rgb2 = explode(',',$rgb_string2);
>        $color1 = imagecolorallocate($im,$rgb1[0],$rgb1[1],$rgb1[2]);
>        $color2 = imagecolorallocate($im,$rgb2[0],$rgb2[1],$rgb2[2]);
>        $px = (imagesx($im) - 7.5 * strlen($input1)) / 2;
>        imagestring($im, 50, $px, 90, $input2, $color1);
>        imagestring($im, 50, ($px + 30), 120, $input1, $color2);
>        imagepng($im);
>        imagedestroy($im);
>    }
> }
> 
> $objects = new Brainteaser();
> 
> $objects->original_image =
> "http://www.sewterific.com/images/Just%20Baskets/SmPicnicBasket.jpg";;
> 
> $_SCRIPT[word] = "task";
> $_SCRIPT[otherword] = "ticket";
> 
> $update_word1 = $_SCRIPT[word]."et";
> 
> $rgb1 = "134,89,32";
> $rgb2 = "231,223,48";
> 
>
$objects->paint($objects->original_image,$rgb1,$rgb2,$update_word1,str_r
eplace("c","s",$_SCRIPT[otherword]));
> 
> ?>
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux