code: public function add_image($image_path, $id) {
          if (file_exists($image_path)) {
              $info = getimagesize($image_path);
              if (is_array($info)) {
                  //$new = sizeof($this->images);
                  $this->images[$id]["path"] = $image_path;
                  $this->images[$id]["width"] = $info[0];
                  $this->images[$id]["height"] = $info[1];
                  $this->images[$id]["mime"] = $info["mime"];
                  $type = explode("/", $info['mime']);
                  $this->images[$id]["type"] = $type[1];
                  $this->images[$id]["id"] = $id;
              } else {
                  $this->errors[] = "Provided file \"" . $image_path . "\" isn't correct image format";
              }
          } else {
              $this->errors[] = "Provided file \"" . $image_path . "\" doesn't exist";
          }
      }
docs: /*
  adds new image
  first parameter - path to image file like ./images/image.png
  second parameter (optiona) - ID of element fro css code generation