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
Parziphal cf9cba40b6 Fully enabled Inline Images.
A little detail: the "Add image" button was moved to a new table row, so it stands out more.
Known bugs/errors:
- When cropping an animated GIF inline (with a secondary JPG inline), although the images are correctly cropped, an empty error is displayed.
2013-12-31 14:22:59 -05:00

19 lines
629 B
PHP
Executable File

<?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);
}
}