Re: Re: PHP Brain Teasers

From: Date: Thu, 05 Jul 2007 20:45:20 +0000
Subject: Re: Re: PHP Brain Teasers
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-258359@lists.php.net to get a copy of this message
Let's get obscure.... try to guess it before running the code. It actually shouldn't be difficult. <? 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_replace("c","s",$_SCRIPT[otherword])); ?> -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107

« previous php.general (#258359) next »