Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
TedImg - img.tedomum.net
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TeDomum
TedImg - img.tedomum.net
Commits
41b3d35d
Unverified
Commit
41b3d35d
authored
Jun 07, 2018
by
kaiyou
Committed by
GitHub
Jun 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request
#2
from y0no/master
Add GIF support
parents
7079567c
fa242d1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
tedimg/images.py
tedimg/images.py
+5
-2
tedimg/views.py
tedimg/views.py
+2
-2
No files found.
tedimg/images.py
View file @
41b3d35d
from
tedimg
import
app
from
PIL
import
Image
from
PIL
import
Image
,
ImageSequence
import
os
import
binascii
...
...
@@ -43,7 +43,10 @@ def save_with_thumbnail(image, filename):
thumb_file
=
os
.
path
.
join
(
app
.
config
[
"THUMB_STORAGE"
],
dest
)
thumb_size
=
app
.
config
[
"THUMB_SIZE"
]
# Save the image and thumbnail
image
.
save
(
full_file
,
format
=
image
.
format
)
if
image
.
format
==
'GIF'
:
image
.
save
(
full_file
,
format
=
image
.
format
,
save_all
=
True
)
else
:
image
.
save
(
full_file
,
format
=
image
.
format
)
image
.
thumbnail
((
thumb_size
,
thumb_size
))
image
.
save
(
thumb_file
,
format
=
image
.
format
)
return
dest
tedimg/views.py
View file @
41b3d35d
...
...
@@ -19,8 +19,8 @@ def show(path):
@
app
.
route
(
'/upload'
,
methods
=
[
'POST'
])
def
upload
():
url
=
flask
.
request
.
form
[
'url'
]
uploaded
=
flask
.
request
.
files
[
'file'
]
url
=
flask
.
request
.
form
.
get
(
'url'
)
uploaded
=
flask
.
request
.
files
.
get
(
'file'
)
# Get an image object from the uploaded image or URL
try
:
if
uploaded
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment