Skip to content

Commit

Permalink
image size defined on model column
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgaspar committed Jan 30, 2015
1 parent fcafe5f commit 5e52310
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
Binary file modified examples/employees/config.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/quickimages/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
UPLOAD_FOLDER = basedir + '/app/static/uploads/'
IMG_UPLOAD_FOLDER = basedir + '/app/static/uploads/'
IMG_UPLOAD_URL = '/static/uploads/'
IMG_SIZE = (150,150,True)
#IMG_SIZE = (150,150,True)
AUTH_TYPE = 1
AUTH_ROLE_ADMIN = 'Admin'
AUTH_ROLE_PUBLIC = 'Public'
Expand Down
8 changes: 6 additions & 2 deletions flask_appbuilder/filemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ def save_file(self, data, filename):


class ImageManager(FileManager):
"""
Image Manager will manage your image files referenced on SQLAlchemy Model
will save files on IMG_UPLOAD_FOLDER as <uuid>_sep_<filename>
"""

keep_image_formats = ('PNG',)

def __init__(self, base_path=None,
Expand All @@ -93,8 +98,7 @@ def __init__(self, base_path=None,

ctx = app_stack.top
if 'IMG_SIZE' in ctx.app.config and not max_size:
max_size = ctx.app.config['IMG_SIZE']
self.max_size = max_size or (300, 200, True)
self.max_size = ctx.app.config['IMG_SIZE']

if 'IMG_UPLOAD_URL' in ctx.app.config and not relative_path:
relative_path = ctx.app.config['IMG_UPLOAD_URL']
Expand Down

0 comments on commit 5e52310

Please sign in to comment.