function toHtml() { $thumb = Thumb::factory($this->vendor, $this->entity, $this->id, $this->name); $url = $thumb->getUrl($this->size); $img = \HtmlImg::addClass('img-rounded pointer img-responsive'); //получим размеры $config_w = Arr::get($thumb->getConfig(), $this->size . '.size.w'); $config_h = Arr::get($thumb->getConfig(), $this->size . '.size.h'); if (!$url) { $img->setAttribute('data-src', 'holder.js/' . $config_w . 'x' . $config_h . '?theme=sky'); } else { $img->setSrc($url . '?' . microtime(true)); } $span = WidgetOverlay::factory()->setIcon('fa fa-crop')->setText('Обрезать миниатюру'); return \HtmlDiv::addClass('thumb-cropper js-btn')->setAttribute('data-thumb-name', $this->name)->setAttribute('data-thumb-size', $this->size)->setAttribute('data-vendor', $this->vendor)->setAttribute('data-action', 'thumb_size')->setContent($span . $img)->__toString(); }
function toHtml() { $thumb = Thumb::factory($this->vendor, $this->entity, $this->id, $this->name); $url = $thumb->getUrl($this->size); $img = \HtmlImg::addClass($this->img_class); //получим размеры $config_w = Arr::get($thumb->getConfig(), $this->size . '.size.w'); $config_h = Arr::get($thumb->getConfig(), $this->size . '.size.h'); if (!$url) { $img->setAttribute('data-src', 'holder.js/' . $config_w . 'x' . $config_h . '?theme=sky'); } else { $img->setSrc($url . '?' . microtime(true)); } $span = WidgetOverlay::factory()->setIcon('fa fa-folder-open-o'); // $span = \HtmlSpan::setContent('<i class="fa fa-folder-open-o"></i>'); return \HtmlDiv::addClass('js-btn box-overlay__wrap box-overlay__wrap--fade box-overlay__wrap--blue box-overlay__wrap--inline')->setAttribute('data-thumb-name', $this->name)->setAttribute('data-thumb-size', $this->size)->setAttribute('data-action', 'thumb_name')->setContent($span . $img)->__toString(); }