This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
Sequenzia/app/helpers/InlineHelper.php

19 lines
629 B
PHP
Raw Normal View History

<?php
class InlineHelper extends Rails\ActionView\Helper
{
public function inline_image_tag($image, array $options = [], array $tag_options = [])
{
if (!empty($options['user_sample']) && $image->has_sample()) {
$url = $image->sample_url();
$tag_options['width'] = $image->sample_width();
$tag_options['height'] = $image->sample_height();
} else {
$url = $image->file_url();
$tag_options['width'] = $image->width;
$tag_options['height'] = $image->height;
}
return $this->imageTag($url, $tag_options);
}
}