public function toHTML()
 {
     $content = "";
     foreach ($this->data[self::ARRAY_IMAGES] as $image) {
         $imageExt = new ImageExtImage($this->imageExt, $image);
         $imageExt->generate();
         $imageExt->optimizeOutput();
         $content .= $imageExt->toHTML();
     }
     if ($this->data[self::ARRAY_ATTR][self::PARA_SNIPPET_GALLERY] !== false && file_exists(kirby()->roots->snippets() . '/' . $this->data[self::ARRAY_ATTR][self::PARA_SNIPPET_GALLERY] . '.php')) {
         $attr = array();
         if (!empty($this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS])) {
             $attr['class'] = $this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS];
         }
         $attr['images'] = $content;
         return (string) snippet($this->data[self::ARRAY_ATTR][self::PARA_SNIPPET_GALLERY], array('data' => $attr), true);
     } else {
         $attr = array();
         if (!empty($this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS])) {
             $attr['class'] = $this->data[self::ARRAY_ATTR][self::PARA_GALLERY_CLASS];
         }
         return \Html::tag("div", $content, $attr);
     }
 }
 public static function getTumb($page, $attr = array())
 {
     if (!is_array($attr) && count($attr) == 0) {
         return "";
     }
     $imageExt = new ImageExt($page);
     $imageExtImage = new ImageExtImage($imageExt);
     $imageExtImage->parse(ImageExtImage::TAG_IMAGE, array(), $attr);
     $imageExtImage->parseFileAttributes();
     $imageExtImage->optimizeOutput();
     if ($imageExt->isDebug()) {
         return $imageExtImage->getDebug();
     } else {
         $imageExtImage->generate();
         return $imageExtImage->toHTML();
     }
 }