Sfoglia il codice sorgente

Latest fix on thumbnail generation

feature/python-3-migration
tr4ck3ur des JM2L 4 anni fa
parent
commit
b7e2ea559e
3 ha cambiato i file con 12 aggiunte e 10 eliminazioni
  1. +2
    -2
      jm2l/forms.py
  2. +1
    -1
      jm2l/templates/NewIndex.mako
  3. +9
    -7
      jm2l/upload.py

+ 2
- 2
jm2l/forms.py Vedi File

@@ -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 Vedi File

@@ -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 Vedi File

@@ -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


Caricamento…
Annulla
Salva