slpctrl Posted January 31, 2009 Share Posted January 31, 2009 Alright, this is a continuation from my last thread, so sorry if that's frowned upon or whatever. Here's my code as it stands: <?php function getpixels($pic){ $image = imagecreatefrompng($pic); list($width, $height) = getimagesize($pic); $height = $height/2; $vars = array(); for ($i=0; $i<=$width; $i++){ $color = imagecolorat($image, $i, $height); array_push($vars, $color); } return $vars; } $pixls = getpixels("http://www.hellboundhackers.org/challenges/timed/timed7/barcode.php"); foreach($pixls as $pixl){ echo $pixl; } ?> And it's output (for what I'll be doing) should look something like so: 0000000000101010111101011110010011011110100010110111101010101101100100001011101001100110101110011100101010000000000 Now, I need to remove the initial zeros and the zeros on the end (as they just stand for the border of a barcode). How would I go about doing this? Quote Link to comment https://forums.phpfreaks.com/topic/143290-stripping-characters-from-an-array/ Share on other sites More sharing options...
.josh Posted January 31, 2009 Share Posted January 31, 2009 trim dude are you even gonna try and work this out on your own or are you just gonna like, ask for help every step of the way? Quote Link to comment https://forums.phpfreaks.com/topic/143290-stripping-characters-from-an-array/#findComment-751507 Share on other sites More sharing options...
.josh Posted January 31, 2009 Share Posted January 31, 2009 lame. what's the fun in doing a challenge when you're asking for other people to do it for you? Quote Link to comment https://forums.phpfreaks.com/topic/143290-stripping-characters-from-an-array/#findComment-751514 Share on other sites More sharing options...
slpctrl Posted January 31, 2009 Author Share Posted January 31, 2009 lame. what's the fun in doing a challenge when you're asking for other people to do it for you? I just ask, and I don't even know why. 99.9% of the time I have it before anyone replies. I need to quit doin that. And, I've only asked for help twice. Don't have a hissy fit, nancy. Quote Link to comment https://forums.phpfreaks.com/topic/143290-stripping-characters-from-an-array/#findComment-751517 Share on other sites More sharing options...
slpctrl Posted January 31, 2009 Author Share Posted January 31, 2009 The questions I'm asking are really to bigger problems I'm having with the code; to say I've asked for help the entire bit of the way is ridiculous. I thought that my result was supposed to be in binary, and it's not. Even with stripping the border, I can't seem to do anything with it anyways. The 0s are the white space, 1s are black. I need to strip the borders off of that (done), and then calculate the UPC number of the barcode and I don't know how to even begin analyzing this to find out the UPC number. I would go straight on the HBH forums to ask for help, but only one person has solved this challenge. Quote Link to comment https://forums.phpfreaks.com/topic/143290-stripping-characters-from-an-array/#findComment-751518 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.