Skip to content

Commit

Permalink
Merge pull request #445 from modilabs/168_thumbnails_no_geocode
Browse files Browse the repository at this point in the history
168 thumbnails no geocode
  • Loading branch information
Peter Lubell-Doughtie committed Jun 11, 2012
2 parents 4055baa + fc97e1f commit fb351b9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
# Place additional keys inorder both alphabeticall and in descending size
THUMB_CONF = {'large' : {'size': 1280, 'suffix': '-lrg'},
'medium' : {'size': 640, 'suffix': '-med'},
'smaller' : {'size': 240, 'suffix': '-sml'}
'smaller' : {'size': 240, 'suffix': '-sml'}
}

TESTING_MODE = False
Expand Down
30 changes: 20 additions & 10 deletions utils/image_tools.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
from cStringIO import StringIO
from PIL import Image
import urllib2 as urllib

from django.conf import settings
from django.core.files.storage import get_storage_class

from utils.viewer_tools import get_path


def get_dimensions((width, height), longest_side):
if width > height:
width = longest_side
height = (height/width) * longest_side
elif height >width:
height = longest_side
width = (width/height) * longest_side
else:
height = longest_side
width = longest_side
return (width, height)
try:
if width > height:
width = longest_side
height = (height/width) * longest_side
elif height >width:
height = longest_side
width = (width/height) * longest_side
else:
height = longest_side
width = longest_side
return (width, height)
except ZeroDivisionError:
return (longest_side, longest_side)


def _save_thumbnails(image, path, size, suffix, filename=None):
Expand Down
1 change: 0 additions & 1 deletion utils/logger_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import tempfile
import traceback
import urllib2 as urllib

from django.conf import settings
from django.contrib.auth.models import User
Expand Down

0 comments on commit fb351b9

Please sign in to comment.