code: private function total_size() {
          $arr = array("width" => 0, "height" => 0);
          foreach ($this->images as $image) {
              if ($arr["width"] < $image["width"]) {
                  $arr["width"] = $image["width"];
              }
              $arr["height"] += $image["height"];
          }
          return $arr;
      }
docs: calculates width and height needed for sprite image