szurubooru/src/Views/post-file-render.phtml
2014-04-30 00:11:53 +02:00

61 lines
1.5 KiB
PHTML

<?php
Assets::setPageThumb(\Chibi\Router::linkTo(
['PostController', 'thumbAction'],
['name' => $this->context->transport->post->name]));
$post = $this->context->transport->post;
?>
<?php if ($post->type == PostType::Image): ?>
<?php if (!empty($this->context->imageLink)): ?>
<a href="<?= $this->context->imageLink ?>">
<?php endif ?>
<img alt="<?= $post->name ?>"
src="<?= \Chibi\Router::linkTo(
['PostController', 'retrieveAction'],
['name' => $post->name]) ?>"/>
<?php if (!empty($this->context->imageLink)): ?>
</a>
<?php endif ?>
<?php elseif ($post->type == PostType::Flash): ?>
<object
type="<?= $post->mimeType ?>"
width="<?= $post->imageWidth ?>"
height="<?= $post->imageHeight ?>"
data="<?= \Chibi\Router::linkTo(
['PostController', 'retrieveAction'],
['name' => $post->name]) ?>">
<param name="wmode" value="opaque"/>
<param name="movie" value="<?= \Chibi\Router::linkTo(
['PostController', 'retrieveAction'],
['name' => $post->name]) ?>"/>
</object>
<?php elseif ($post->type == PostType::Youtube): ?>
<iframe
style="width: 800px; height: 600px; border: 0;"
src="//www.youtube.com/embed/<?= $post->fileHash ?>?wmode=opaque"
allowfullscreen>
</iframe>
<?php elseif ($post->type == PostType::Video): ?>
<video style="max-width: 100%" controls>
<source
type="<?= $post->mimeType ?>"
src="<?= \Chibi\Router::linkTo(
['PostController', 'retrieveAction'],
['name' => $post->name]) ?>">
Your browser doesn't support HTML5 &lt;video&gt; tag.
</video>
<?php endif ?>