diff --git a/BoxImage.class.php b/BoxImage.class.php index f83b6ee..c0f8778 100644 --- a/BoxImage.class.php +++ b/BoxImage.class.php @@ -111,11 +111,11 @@ class BoxImage { //if we go back if($step === -1) { //decrease x-pointer - $this->pointer_x--; + $this->pointer_x -= 1; //handle y-jumps - if($this->pointer_x === 0) { + if($this->pointer_x < 0) { $this->pointer_x = $width; - $this->pointer_y--; + $this->pointer_y -= 1; //out of range? if($this->pointer_y < 0) throw new Exception("Out of range! (width)"); } @@ -123,11 +123,11 @@ class BoxImage { //if we go forward } elseif($step === 1) { //increase x-pointer - $this->pointer_x++; + $this->pointer_x += 1; //handle y-jumps - if($this->pointer_x === $this->width) { + if($this->pointer_x > $this->width) { $this->pointer_x = 0; - $this->pointer_y++; + $this->pointer_y += 1; //out of range? if($this->pointer_y > $this->height) throw new Exception("Out of range! (height)"); } diff --git a/test.jpg b/test.jpg new file mode 100644 index 0000000..6ee6d4b Binary files /dev/null and b/test.jpg differ