public static function Image($attributes) { $value = Html::getValueFromArray($attributes); $attr = Html::getAttributes($attributes); require 'Html/media.php'; $imageId = $value; $from = null; if (isset($attributes['from'])) { $from = $attributes['from']; } else { throw new Exception("Add 'from' attribute in Html:Image tag"); } $imageModel = new SKS\MODEL\ImageModel(); $imageInfo = $imageModel->getImageInfo($imageId); $imageName = isset($imageInfo['name']) ? $imageInfo['name'] : ""; global $is_first_image_uploader; if (!isset($is_first_image_uploader)) { $is_first_image_uploader = true; } $out = "<div> \n <input type='file' class='hidden' size='1' name='file_input_image' accept='image/*'>\n <input type='hidden' {$attr} class='hidden_field ' value='{$value}' from='{$from}'/>\n <span class='btn btn-default btn-file'>Browse <input type='file' class='media'> <label>{$imageName}</label> \n <a class='close-reveal-modal'>×</a>\n </span>\n <span class='image_container'>"; if (isset($imageInfo['thumb_small'])) { $out .= " <img src='" . URL . $imageInfo['thumb_small'] . "' height='30px;'>"; } $out .= "</span>\n </div> \n "; return $out; }
<?php $imageId = 1; $imageModel = new SKS\MODEL\ImageModel(); $imageInfo = $imageModel->getImageInfo($imageId); global $is_first_image_uploader; if (!isset($is_first_image_uploader)) { require 'media_js.php'; $is_first_image_uploader = true; } ?>