fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
translation update
[wolnelektury.git]
/
src
/
picture
/
engine.py
diff --git
a/src/picture/engine.py
b/src/picture/engine.py
index
574e5a8
..
83d255d
100644
(file)
--- a/
src/picture/engine.py
+++ b/
src/picture/engine.py
@@
-1,6
+1,7
@@
from sorl.thumbnail.engines import pil_engine
from sorl.thumbnail import parsers
from sorl.thumbnail.engines import pil_engine
from sorl.thumbnail import parsers
+
#
# Class developed by
# http://timmyomahony.com/blog/custom-cropping-engine-sorl-thumbnail/
#
# Class developed by
# http://timmyomahony.com/blog/custom-cropping-engine-sorl-thumbnail/
@@
-34,7
+35,7
@@
class CustomCroppingEngine(pil_engine.Engine):
m = parsers.bgpos_pat.match(crop)
if not m:
raise parsers.ThumbnailParseError('Unrecognized crop option: %s' % crop)
m = parsers.bgpos_pat.match(crop)
if not m:
raise parsers.ThumbnailParseError('Unrecognized crop option: %s' % crop)
- value = int(m.group('value')) # we only take ints in the regexp
+ value = int(m.group('value'))
# we only take ints in the regexp
unit = m.group('unit')
if unit == '%':
value = epsilon * value / 100.0
unit = m.group('unit')
if unit == '%':
value = epsilon * value / 100.0
@@
-50,7
+51,7
@@
class CustomCroppingEngine(pil_engine.Engine):
if not crop or crop == 'noop':
return image
x_image, y_image = self.get_image_size(image)
if not crop or crop == 'noop':
return image
x_image, y_image = self.get_image_size(image)
- x1,
y1,x2,
y2 = self._crop_parse(crop, (x_image, y_image), geometry)
+ x1,
y1, x2,
y2 = self._crop_parse(crop, (x_image, y_image), geometry)
return self._crop(image, x1, y1, x2, y2)
def _crop(self, image, x1, y1, x2, y2):
return self._crop(image, x1, y1, x2, y2)
def _crop(self, image, x1, y1, x2, y2):