Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/143290-stripping-characters-from-an-array/
Share on other sites

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.