##// 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 from random import random
3 from random import random
4 import time
4 import time
5 from django.db import models
5 from django.db import models
6 from django.template.defaultfilters import filesizeformat
6 from boards import thumbs
7 from boards import thumbs
7 from boards.models.base import Viewable
8 from boards.models.base import Viewable
8
9
@@ -88,6 +89,8 b' class PostImage(models.Model, Viewable):'
88 return self.image.url
89 return self.image.url
89
90
90 def get_view(self):
91 def get_view(self):
92 metadata = '{}, {}'.format(self.image.name.split('.')[-1],
93 filesizeformat(self.image.size))
91 return '<div class="{}">' \
94 return '<div class="{}">' \
92 '<a class="{}" href="{full}">' \
95 '<a class="{}" href="{full}">' \
93 '<img class="post-image-preview"' \
96 '<img class="post-image-preview"' \
@@ -98,8 +101,10 b' class PostImage(models.Model, Viewable):'
98 ' data-width="{}"' \
101 ' data-width="{}"' \
99 ' data-height="{}" />' \
102 ' data-height="{}" />' \
100 '</a>' \
103 '</a>' \
104 '<div class="image-metadata">{image_meta}</div>' \
101 '</div>'\
105 '</div>'\
102 .format(CSS_CLASS_IMAGE, CSS_CLASS_THUMB,
106 .format(CSS_CLASS_IMAGE, CSS_CLASS_THUMB,
103 self.image.url_200x150,
107 self.image.url_200x150,
104 str(self.hash), str(self.pre_width),
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 .tree_reply > .post {
528 .tree_reply > .post {
529 margin-left: 1ex;
530 margin-top: 1ex;
529 margin-top: 1ex;
531 border-left: solid 1px #777;
530 border-left: solid 1px #777;
532 border-right: solid 1px #777;
531 padding-right: 0;
533 }
532 }
534
533
535 #preview-text {
534 #preview-text {
@@ -543,3 +542,8 b' button {'
543 margin-bottom: .5ex;
542 margin-bottom: .5ex;
544 margin-top: .5ex;
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 margin: 1ex 0 1ex 0;
376 margin: 1ex 0 1ex 0;
377 padding: 1ex;
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 margin: 1ex 0 1ex 0;
407 margin: 1ex 0 1ex 0;
408 padding: 1ex;
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