瀏覽代碼

Latest fix on thumbnail generation

feature/python-3-migration
tr4ck3ur des JM2L 4 年之前
父節點
當前提交
b7e2ea559e
共有 3 個文件被更改,包括 12 次插入10 次删除
  1. +2
    -2
      jm2l/forms.py
  2. +1
    -1
      jm2l/templates/NewIndex.mako
  3. +9
    -7
      jm2l/upload.py

+ 2
- 2
jm2l/forms.py 查看文件

@@ -112,7 +112,7 @@ class TiersMember(MyBaseForm):
csrf = False

year_uid = SelectField(u'Année', coerce=int,
choices=zip(range(2006, CurrentYear + 1), range(2006, CurrentYear + 1)))
choices=list(zip(range(2006, CurrentYear + 1), range(2006, CurrentYear + 1))))
user_uid = StringField(u'user')
role = StringField(u'Role')

@@ -122,7 +122,7 @@ class TiersRole(MyBaseForm):
csrf = False

year_uid = SelectField(u'Année', coerce=int,
choices=zip(range(2006, CurrentYear + 1), range(2006, CurrentYear + 1)))
choices=list(zip(range(2006, CurrentYear + 1), range(2006, CurrentYear + 1))))
tiers_role = SelectField(u'Role', choices=TIERS_ROLE)




+ 1
- 1
jm2l/templates/NewIndex.mako 查看文件

@@ -1,6 +1,6 @@
<%inherit file="jm2l:templates/layout.mako"/>
<%def name="jsAddOn()">
<script src="/vendor/timeline/js/timeline-src.js"></script>
<script src="/vendor/timeline/js/timeline-min.js"></script>
<script>
var timeline = new VMM.Timeline("timeline", '95%', '600px');
var c = {language:{ lang:"fr",api:{wikipedia:"fr"},date:{month:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],month_abbr:["janv.","févr.","mars","avril","mai","juin","juil.","août","sept.","oct.","nov.","dec."],day:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],day_abbr:["Dim.","Lu.","Ma.","Me.","Jeu.","Vend.","Sam."]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"d mmm",full:"d mmmm yyyy",time_short:"HH:MM:SS",time_no_seconds_short:"HH:MM",time_no_seconds_small_date:"HH:MM'<br/><small>'d mmmm yyyy'</small>'",full_long:"dddd',' d mmm yyyy 'à' HH:MM",full_long_small_date:"HH:MM'<br/><small>'dddd',' d mmm yyyy'</small>'"},messages:{loading_timeline:"Chargement de la frise en cours... ",return_to_title:"Retour à la page d'accueil",expand_timeline:"Elargir la frise",contract_timeline:"Réduire la frise",wikipedia:"Extrait de Wikipedia, l'encyclopédie libre",loading_content:"Chargement",loading:"Chargement",swipe_nav:"Swipe to Navigate"}}};


+ 9
- 7
jm2l/upload.py 查看文件

@@ -314,8 +314,10 @@ 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))
(int((THUMBNAIL_SIZE - image.size[0]) / 2), int((THUMBNAIL_SIZE - image.size[1]) / 2)))
TargetFileName = self.thumbnailpath(filename)
if not TargetFileName.endswith('png'):
timage = timage.convert('RGB')
timage.save(TargetFileName)
return self.thumbnailurl(os.path.basename(TargetFileName))

@@ -331,7 +333,7 @@ class MediaUpload(MediaPath):
# Add thumbnail
timage.paste(
image,
((THUMBNAIL_SIZE - image.size[0]) / 2, (THUMBNAIL_SIZE - image.size[1]) / 2))
(int((THUMBNAIL_SIZE - image.size[0]) / 2), int((THUMBNAIL_SIZE - image.size[1]) / 2)))
# Stamp with PDF file type
timage.paste(
pdf_indicator,
@@ -355,7 +357,7 @@ class MediaUpload(MediaPath):
# Add thumbnail
timage.paste(
image,
((THUMBNAIL_SIZE - image.size[0]) / 2, (THUMBNAIL_SIZE - image.size[1]) / 2))
(int((THUMBNAIL_SIZE - image.size[0]) / 2), int((THUMBNAIL_SIZE - image.size[1]) / 2)))
# Stamp with PDF file type
timage.paste(
pdf_indicator,
@@ -387,7 +389,7 @@ class MediaUpload(MediaPath):
# Add thumbnail
timage.paste(
image,
((THUMBNAIL_SIZE - image.size[0]) / 2, (THUMBNAIL_SIZE - image.size[1]) / 2))
(int((THUMBNAIL_SIZE - image.size[0]) / 2), int((THUMBNAIL_SIZE - image.size[1]) / 2)))
# Stamp with PDF file type
timage.paste(
stamp,
@@ -420,7 +422,7 @@ class MediaUpload(MediaPath):
# Add thumbnail
timage.paste(
image,
((THUMBNAIL_SIZE - image.size[0]) / 2, (THUMBNAIL_SIZE - image.size[1]) / 2))
(int((THUMBNAIL_SIZE - image.size[0]) / 2), int((THUMBNAIL_SIZE - image.size[1]) / 2)))
# Stamp with Blender file type
timage.paste(
blender_indicator,
@@ -526,8 +528,8 @@ class MediaUpload(MediaPath):
return self.delete()
results = []
for name, fieldStorage in self.request.POST.items():
if isinstance(fieldStorage, unicode):
continue
# if isinstance(fieldStorage, unicode):
# continue
result = {}
result['name'] = os.path.basename(fieldStorage.filename)
result['type'] = fieldStorage.type


Loading…
取消
儲存