diff options
-rw-r--r-- | jm2l/captcha.py | 6 | ||||
-rw-r--r-- | jm2l/upload.py | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/jm2l/captcha.py b/jm2l/captcha.py index 65ab5db..4fd6828 100644 --- a/jm2l/captcha.py +++ b/jm2l/captcha.py @@ -48,8 +48,8 @@ class _PyCaptcha_WarpBase(object): def render(self, image): r = self.resolution - xPoints = image.size[0] / r + 2 - yPoints = image.size[1] / r + 2 + xPoints = image.size[0] // r + 2 + yPoints = image.size[1] // r + 2 f = self.get_transform(image) # Create a list of arrays with transformed points @@ -124,7 +124,7 @@ def DoCaptcha(request): # Choose a word for captcha text = random.choice(TabMots) Xt, Yt = font.getsize(text) - OrX, OrY = (ImgSize[0]-Xt)/2, (ImgSize[1]-Yt)/2 + OrX, OrY = (ImgSize[0]-Xt)//2, (ImgSize[1]-Yt)//2 draw.text((OrX, OrY), text, font=font, fill="#000000") # Apply a Blur # WorkImg=WorkImg.filter(ImageFilter.BLUR) diff --git a/jm2l/upload.py b/jm2l/upload.py index a1eadc0..cbbbfff 100644 --- a/jm2l/upload.py +++ b/jm2l/upload.py @@ -180,7 +180,7 @@ class MediaUpload(MediaPath): timage = Image.new('RGBA', (THUMBNAIL_SIZE, THUMBNAIL_SIZE), (255, 255, 255, 0)) timage.paste( image, - ((THUMBNAIL_SIZE - image.size[0]) / 2, (THUMBNAIL_SIZE - image.size[1]) / 2)) + ((THUMBNAIL_SIZE - image.size[0]) // 2, (THUMBNAIL_SIZE - image.size[1]) // 2)) TargetFileName = self.thumbnailpath(filename) timage.save( TargetFileName ) return self.thumbnailurl( os.path.basename(TargetFileName) ) @@ -197,7 +197,7 @@ class MediaUpload(MediaPath): # Add thumbnail timage.paste( image, - ((THUMBNAIL_SIZE - image.size[0]) / 2, (THUMBNAIL_SIZE - image.size[1]) / 2)) + ((THUMBNAIL_SIZE - image.size[0]) // 2, (THUMBNAIL_SIZE - image.size[1]) // 2)) # Stamp with PDF file type timage.paste( pdf_indicator, @@ -225,13 +225,13 @@ class MediaUpload(MediaPath): ('Impress','odp'), ('Calc','ods'), ('Draw','odg')] - stampfilename = filter(lambda (x,y): ext.endswith(y), istamp) + stampfilename = filter(lambda x,y : ext.endswith(y), istamp) stamp = Image.open( "jm2l/static/img/%s-icon.png" % stampfilename[0][0]) timage = Image.new('RGBA', (THUMBNAIL_SIZE, THUMBNAIL_SIZE), (255, 255, 255, 0)) # Add thumbnail timage.paste( image, - ((THUMBNAIL_SIZE - image.size[0]) / 2, (THUMBNAIL_SIZE - image.size[1]) / 2)) + ((THUMBNAIL_SIZE - image.size[0]) // 2, (THUMBNAIL_SIZE - image.size[1]) // 2)) # Stamp with PDF file type timage.paste( stamp, |