##// END OF EJS Templates
Added image format and size label to images
neko259 -
r1245:ea38de1e default
parent child Browse files
Show More
@@ -3,6 +3,7 b' import os'
3 3 from random import random
4 4 import time
5 5 from django.db import models
6 from django.template.defaultfilters import filesizeformat
6 7 from boards import thumbs
7 8 from boards.models.base import Viewable
8 9
@@ -88,6 +89,8 b' class PostImage(models.Model, Viewable):'
88 89 return self.image.url
89 90
90 91 def get_view(self):
92 metadata = '{}, {}'.format(self.image.name.split('.')[-1],
93 filesizeformat(self.image.size))
91 94 return '<div class="{}">' \
92 95 '<a class="{}" href="{full}">' \
93 96 '<img class="post-image-preview"' \
@@ -98,8 +101,10 b' class PostImage(models.Model, Viewable):'
98 101 ' data-width="{}"' \
99 102 ' data-height="{}" />' \
100 103 '</a>' \
104 '<div class="image-metadata">{image_meta}</div>' \
101 105 '</div>'\
102 106 .format(CSS_CLASS_IMAGE, CSS_CLASS_THUMB,
103 107 self.image.url_200x150,
104 108 str(self.hash), str(self.pre_width),
105 str(self.pre_height), str(self.width), str(self.height), full=self.image.url)
109 str(self.pre_height), str(self.width), str(self.height),
110 full=self.image.url, image_meta=metadata)
@@ -526,10 +526,9 b' ul {'
526 526 }
527 527
528 528 .tree_reply > .post {
529 margin-left: 1ex;
530 529 margin-top: 1ex;
531 530 border-left: solid 1px #777;
532 border-right: solid 1px #777;
531 padding-right: 0;
533 532 }
534 533
535 534 #preview-text {
@@ -543,3 +542,8 b' button {'
543 542 margin-bottom: .5ex;
544 543 margin-top: .5ex;
545 544 }
545
546 .image-metadata {
547 font-style: italic;
548 font-size: 0.9em;
549 } No newline at end of file
@@ -376,3 +376,8 b' input[type="submit"]:hover {'
376 376 margin: 1ex 0 1ex 0;
377 377 padding: 1ex;
378 378 }
379
380 .image-metadata {
381 font-style: italic;
382 font-size: 0.9em;
383 } No newline at end of file
@@ -407,3 +407,8 b' li {'
407 407 margin: 1ex 0 1ex 0;
408 408 padding: 1ex;
409 409 }
410
411 .image-metadata {
412 font-style: italic;
413 font-size: 0.9em;
414 } No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now