kirgy9 wrote:
.-,.-,. -.-.-.- ---. ,--. ----., .,.--,
The problem which REALLY confused me is why are there 4 different types of charactors?? Any ideas?
Can anyone give me some pointers on what im doing fundementaly wrong?
FR34K wrote:Im so proud this is the first one I did without stealing any code off google (i took the guts of the irc bot from an already existing bot that greets people when the join)
I am using these HTS challenges to teach myself C# and this one taught me so much
Tips for others:
Take it one piece at a time, you need:
1 part to "look" at the image
1 part to convert the image to code
1 part to decypher the code
and a final part to echo the code back
Hope that isnt to much(its another way of stating the instructions in easier terms i hope)
<?
$source = 'http://www.hackthissite.org/missions/prog/2/PNG/';
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
$output = curl_exec($ch);
$fp = fopen('dots.png', "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
fclose($fp);
$imgFile = 'dots.png';
$im = imagecreatefrompng($imgFile);
imagepng($im,$imgFile);
$imgWidth = imagesx($im);
$imgHeight = imagesy($im);
$res='';
for ($y=0; $y < $imgHeight; $y++){
for ($x=0; $x < $imgWidth; $x++){
$ndx = imagecolorat($im,$x,$y);
$aryColors = imagecolorsforindex($im,$ndx);
print substr("R".dechex($aryColors['red']),-2);
print substr("G".dechex($aryColors['green']),-2);
print substr("B".dechex($aryColors['blue']),-2);
}
}
void convertimg(){
CImg<unsigned short> img("PNG.png");
img.save_ascii("hi5.txt"); // HTS PROG MISSION 2
}
Users browsing this forum: No registered users and 0 guests