Navigation Menu

Skip to content

Commit

Permalink
Add GIF upload possibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywink committed Sep 2, 2017
1 parent 8b84886 commit e42748b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions markdownx/forms.py
Expand Up @@ -33,6 +33,9 @@ class ImageForm(forms.Form):
# processed a text file rather than image.
_SVG_TYPE = 'image/svg+xml'

# Skip processing for these types
_SKIP_PROCESS = ('image/gif', _SVG_TYPE)

def save(self, commit=True):
"""
Saves the uploaded image in the designated location.
Expand All @@ -56,10 +59,10 @@ def save(self, commit=True):
image_extension = content_type.split('/')[-1].upper()
image_size = getattr(image, '_size')

if content_type.lower() != self._SVG_TYPE:
if content_type.lower() not in self._SKIP_PROCESS:
# Processing the raster graphic image.
# Note that vector graphics in SVG format
# do not require additional processing and
# or GIF images do not require additional processing and
# may be stored as uploaded.
image = self._process_raster(image, image_extension)
image_size = image.tell()
Expand Down
2 changes: 1 addition & 1 deletion markdownx/settings.py
Expand Up @@ -8,7 +8,7 @@
# ------------------------------------------------------------------

FIFTY_MEGABYTES = 50 * 1024 * 1024
VALID_CONTENT_TYPES = 'image/jpeg', 'image/png', 'image/svg+xml'
VALID_CONTENT_TYPES = 'image/jpeg', 'image/png', 'image/svg+xml', 'image/gif'
NINETY_DPI = 90
IM_WIDTH = 500
IM_HEIGHT = 500
Expand Down

0 comments on commit e42748b

Please sign in to comment.