Ejemplo n.º 1
0
 /**
  * Генерирует код для миниатюры
  *
  * @param string $file
  * @param string $preset
  */
 public static function getThumbCode($file, $preset = 'image.medium')
 {
     $file = UPLOADS . $file;
     $thumbnail = image_preset($preset, $file, TRUE);
     $preset = str_replace('.', '-', $preset);
     return HTML::a(File::pathToUri($file), self::getCode($thumbnail), array('class' => 'preset ' . $preset));
 }
Ejemplo n.º 2
0
<?php

$thumb = File::pathToUri(image_preset('image.thumb', UPLOADS . DS . $file->path));
?>
<a class="fancybox sh" href="<?php 
echo $file->getLink();
?>
" class="file-<?php 
echo $file->info->getExtension();
?>
">
    <img src="<?php 
echo $thumb;
?>
">
</a>
Ejemplo n.º 3
0
 /**
  * Render avatar
  *  
  * @param string $file 
  */
 public function render($preset = 'avatar.small')
 {
     $file = UPLOADS . '/' . $this->file;
     return HTML::img(Url::toUri(image_preset($preset, $file)), $this->object->login, array('class' => 'avatar'));
 }
Ejemplo n.º 4
0
 /**
  * Get HTML image avatar
  *
  * @param string $preset
  * @return string
  */
 public function getAvatarImage($preset = 'avatar.small')
 {
     return HTML::img(image_preset($preset, $this->getAvatar()->getFile(), TRUE), $this->login, array('class' => 'avatar', 'title' => $this->getName()));
 }
Ejemplo n.º 5
0
 /**
  * Render avatar
  *
  * @param string $file
  */
 public function render($preset = 'avatar.small')
 {
     return HTML::img(Url::toUri(image_preset($preset, $this->getFile())), $this->object()->login, array('class' => 'avatar'));
 }
Ejemplo n.º 6
0
<?php

if ($value && file_exists(UPLOADS . $value)) {
    ?>
<div class="image-preview"><img src="<?php 
    echo File::pathToUri($element->options->preset ? image_preset($element->options->preset, UPLOADS . $value) : UPLOADS . $value);
    ?>
"></div>
<label class="checkbox"><input type="checkbox" name="<?php 
    echo $element->name;
    ?>
" value=""/> <?php 
    echo t('Удалить');
    ?>
</label>
<?php 
} else {
    echo HTML::input($element->options);
}
?>