summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-08-09 19:09:47 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-08-09 19:09:47 +0200
commitfd9d3931f84debc7577a13f12121eb5159d7e701 (patch)
tree9d4a97e66039788fa54274691e403995af733f55 /application
parentefcdc56c7a2a50b04b818ba5c913519e8050faa6 (diff)
Increase performance of thumbnail view
site_url is rather slow and the improvement is noticeable when there are lots of thumbnails (thumbnail history). Also make the code more readable in the process by inserting some linebreaks. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/views/file/fragments/thumbnail.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/application/views/file/fragments/thumbnail.php b/application/views/file/fragments/thumbnail.php
index d830a1bed..23f370618 100644
--- a/application/views/file/fragments/thumbnail.php
+++ b/application/views/file/fragments/thumbnail.php
@@ -1,8 +1,24 @@
<!-- Comment markers background: http://stackoverflow.com/a/14776780/953022 -->
<div class="container container-wide">
+<?php
+$base_url = site_url();
+if (substr($base_url, -1) !== "/") {
+ $base_url .= "/";
+}
+?>
<div class="upload_thumbnails"><!--
<?php foreach($items as $key => $item): ?>
- --><a <?php if (strpos($item["mimetype"], "image/") === 0) {?>rel="gallery" class="colorbox"<?php } ?> data-orientation="<?php echo $item["orientation"]; ?>" href="<?php echo site_url("/".$item["id"])."/"; ?>" title="<?php echo htmlentities($item["filename"]); ?>" data-content="<?php echo htmlentities($item["tooltip"]); ?>" data-id="<?php echo $item["id"]; ?>"><img class="thumb lazyload" data-original="<?php echo site_url("file/thumbnail/".$item["id"]); ?>"><noscript><img class="thumb" src="<?php echo site_url("file/thumbnail/".$item["id"]); ?>"></noscript></a><!--
+ --><a
+ <?php if (strpos($item["mimetype"], "image/") === 0) {?>rel="gallery" class="colorbox"<?php } ?>
+ data-orientation="<?php echo $item["orientation"]; ?>"
+ href="<?php echo $base_url.$item["id"]."/"; ?>"
+ title="<?php echo htmlentities($item["filename"]); ?>"
+ data-content="<?php echo htmlentities($item["tooltip"]); ?>"
+ data-id="<?php echo $item["id"]; ?>"><!--
+ --><img class="thumb lazyload"
+ data-original="<?php echo $base_url."file/thumbnail/".$item["id"]; ?>"
+ ><!--
+ --><noscript><img class="thumb" src="<?php echo $base_url."file/thumbnail/".$item["id"]; ?>"></noscript></a><!--
<?php endforeach; ?>
-->
</div>