diff options
author | luxagraf <sng@luxagraf.net> | 2013-09-13 00:52:33 +0000 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2013-09-13 00:52:33 +0000 |
commit | 79b3268e10706e1ea14d7ba1275a9744ce51cd3a (patch) | |
tree | 7b4137bcbaa90106becac0b8cba408838e9ba560 | |
parent | 3a0e7dde40a08cd8e31652ea6c4094ce70ec36bb (diff) |
fixed some bugs related to larger images and new flickr scripts
-rw-r--r-- | app/photos/models.py | 6 | ||||
-rw-r--r-- | app/photos/retriever.py | 6 | ||||
-rw-r--r-- | design/templates/details/photo_galleries.html | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/app/photos/models.py b/app/photos/models.py index a87b60d..e64e186 100644 --- a/app/photos/models.py +++ b/app/photos/models.py @@ -85,6 +85,8 @@ class Photo(models.Model): def get_original_url(self): #return self.get_pic_url(size="original") return "http://farm%s.static.flickr.com/%s/%s_%s_o.jpg" % (self.flickr_farm, self.flickr_server, self.flickr_id, self.flickr_originalsecret) + def get_retina_slideshow_url(self): + return '%sslideshow/%s/%sx2.jpg' %(settings.IMAGES_URL,self.pub_date.strftime("%Y"),self.flickr_id) def has_retina(self): return os.path.isfile('%s/slideshow/%s/%sx2.jpg' %(settings.IMAGES_ROOT,self.pub_date.strftime("%Y"),self.flickr_id)) @@ -151,8 +153,8 @@ class Photo(models.Model): def get_tumble_image(self): return "%s/crops/%s/%s.jpg" %(settings.IMAGES_URL, self.pub_date.strftime("%Y/%b").lower(), self.id) - - + + def get_previous_published(self): return self.get_previous_by_pub_date() diff --git a/app/photos/retriever.py b/app/photos/retriever.py index 959b908..4dfbc49 100644 --- a/app/photos/retriever.py +++ b/app/photos/retriever.py @@ -134,9 +134,9 @@ def get_photos_in_set(flickr_photoset, photoset): p = Photo.objects.get(flickr_id__exact=str(photo['id'])) except ObjectDoesNotExist: p = get_photo(photo) - print p.title - photoset.photos.add(p) - slideshow_image(p, 1000, 800, 95) + if p.is_public == True: + photoset.photos.add(p) + slideshow_image(p, 1000, 800, 95) ################################################ diff --git a/design/templates/details/photo_galleries.html b/design/templates/details/photo_galleries.html index 33550f7..a7eed95 100644 --- a/design/templates/details/photo_galleries.html +++ b/design/templates/details/photo_galleries.html @@ -20,7 +20,7 @@ <h1 class="hide">Photos from {{object.set_title}}</h1>{%for photo in object.photos.all reversed %} <article id="image-{{forloop.counter}}"> <h6><a href="#image-{{forloop.counter}}" class="permalink" title="link to this image">∞ {{forloop.counter|number_to_word}} ∞</a></h6> - <div class="fig"><img src="{{photo.get_local_slideshow_url}}" {% if photo.has_retina %}srcset="{{photo.get_local_slideshow_url}}x2 2x"{% endif %} alt="{{photo.title}}" title="{{photo.title}}" {%if photo.is_portait %}class="v"{%endif%} height="{{photo.slideshowimage_height}}" width="{{photo.slideshowimage_width}}" /></div> + <div class="fig"><img src="{{photo.get_local_slideshow_url}}" {% if photo.has_retina %}srcset="{{photo.get_retina_slideshow_url}} 2x"{% endif %} alt="{{photo.title}}" title="{{photo.title}}" {%if photo.is_portait %}class="v"{%endif%} height="{{photo.slideshowimage_height}}" width="{{photo.slideshowimage_width}}" style="max-width: {{photo.slideshowimage_width}}px" /></div> <div class="figcaption"> <div class="caption" id="id-{{photo.id}}"> <h3>{{photo.title}} <time datetime="{{photo.exif_date|date:'c'}}" pubdate>{{photo.exif_date|date:"M j, Y"}}</time></h3> |