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/views/post/show_partials/_image.php

70 lines
3.2 KiB
PHP
Raw Normal View History

2013-10-27 01:06:58 +02:00
<?php if (!$this->post->is_deleted()) : ?>
<div<?php if (CONFIG()->dblclick_resize_image) echo ' ondblclick="Post.resize_image(); return false;"' ?>>
<?php if (!$this->post->can_be_seen_by(current_user())) : ?>
2017-01-25 12:24:01 +01:00
<p>This post is restricted</p>
2013-10-27 01:06:58 +02:00
<?php elseif ($this->post->image()) : ?>
<div id="note-container">
<?php foreach ($this->post->active_notes() as $note) : ?>
<div class="note-box" style="width: <?= $note->width ?>px; height: <?= $note->height ?>px; top: <?= $note->y ?>px; left: <?= $note->x ?>px;" id="note-box-<?= $note->id ?>">
<div class="note-corner" id="note-corner-<?= $note->id ?>"></div>
</div>
<div class="note-body" id="note-body-<?= $note->id ?>" title="Click to edit"><?= $note->formatted_body() ?></div>
<?php endforeach ?>
</div>
<?php
$file_sample = $this->post->get_file_sample(current_user());
$jpeg = $this->post->get_file_jpeg(current_user());
echo $this->imageTag($file_sample['url'], array(
'alt' => $this->post->tags(),
'id' => 'image',
'class' => 'image',
'width' => $file_sample['width'] ?: $jpeg['width'],
'height' => $file_sample['height'] ?: $jpeg['height'],
2013-10-27 01:06:58 +02:00
'large_width' => $jpeg['width'],
'large_height' => $jpeg['height'])); ?>
<?php elseif ($this->post->flash()) : ?>
<object width="<?= $this->post->width ?>" height="<?= $this->post->height ?>">
<param name="movie" value="<?= $this->post->file_url() ?>">
<embed src="<?= $this->post->file_url() ?>" width="<?= $this->post->width ?>" height="<?= $this->post->height ?>" allowScriptAccess="never"></embed>
</object>
<p><?= $this->linkTo($this->t('post_flash_dl'), $this->post->file_url()) ?></p>
2016-09-09 10:56:51 +02:00
<?php elseif ($this->post->video()) : ?>
<div>
<video controls="true" autoplay="true" loop="true" >
<source src="<?= $this->post->file_url() ?>" type="video/mp4">
Your browser does not support webm video.
</video>
</div>
2013-10-27 01:06:58 +02:00
<?php else: ?>
<h2><a href="<?= $this->post->file_url() ?>"><?= $this->t('post_download') ?></a></h2>
<p><?= $this->t('post_download_text') ?></p>
<?php endif ?>
</div>
<div style="margin-bottom: 1em;">
<p id="note-count"></p>
<script type="text/javascript">
2013-11-21 20:03:07 +01:00
jQuery('#image').on('mousedown', function(e){
2013-10-27 01:06:58 +02:00
if (e.shiftKey) Note.dragCreate(e)
})
Note.post_id = <?= $this->post->id ?>
<?php foreach ($this->post->active_notes() as $note) : ?>
Note.all.push(new Note(<?= $note->id ?>, false, '<?= str_replace("\n", '\n', addslashes($this->h($note->body))) ?>'))
<?php endforeach ?>
Note.updateNoteCount()
Note.show()
jQuery(function() {
var note_toggle = true;
new WindowDragElement($("image"), {condition: function(){ if (Note.drag_created) return false; }, startdrag: function(){ note_toggle=false; }});
$("image").observe("mouseup", function(e) { if(note_toggle) Note.toggle();else note_toggle=true; }.bindAsEventListener());
});
</script>
</div>
<?php endif ?>