diff options
| -rw-r--r-- | chimere/models.py | 7 | ||||
| -rw-r--r-- | chimere/views.py | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/chimere/models.py b/chimere/models.py index e98c97b..5c98de7 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -626,16 +626,17 @@ def picturefile_post_save(sender, **kwargs): if kwargs['created']: filename = picturefile.picture.path - metadata = None + metadata, orientation = None, None if PYEXIV2_OLD_API: metadata = pyexiv2.Image(filename) metadata.readMetadata() + orientation = metadata['Exif.Image.Orientation'] \ + if 'Exif.Image.Orientation' in metadata.exifKeys() else None else: metadata = pyexiv2.ImageMetadata(filename) metadata.read() - orientation = metadata['Exif.Image.Orientation'].value \ + orientation = metadata['Exif.Image.Orientation'].value \ if 'Exif.Image.Orientation' in metadata else None - print "orientation", orientation if orientation and orientation in IMAGE_EXIF_ORIENTATION_MAP \ and orientation > 1: metadata['Exif.Image.Orientation'] = 1 diff --git a/chimere/views.py b/chimere/views.py index e8fb622..4a97a62 100644 --- a/chimere/views.py +++ b/chimere/views.py @@ -59,8 +59,9 @@ def get_base_uri(request): base_uri = 'https://' if 'SERVER_NAME' in request.META: base_uri += request.META['SERVER_NAME'] - if 'SERVER_PORT' in request.META: - base_uri += ":" + request.META['SERVER_PORT'] + if 'SERVER_PORT' in request.META and \ + str(request.META['SERVER_PORT']) != '80': + base_uri += ":" + str(request.META['SERVER_PORT']) return base_uri #TODO: convert to requestcontext |
