Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
68c99192
Commit
68c99192
authored
12 years ago
by
Vik Paruchuri
Browse files
Options
Downloads
Patches
Plain Diff
Add some docstrings for image class
parent
f729bf3b
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/xmodule/xmodule/open_ended_image_submission.py
+14
-0
14 additions, 0 deletions
common/lib/xmodule/xmodule/open_ended_image_submission.py
with
14 additions
and
0 deletions
common/lib/xmodule/xmodule/open_ended_image_submission.py
+
14
−
0
View file @
68c99192
"""
This contains functions and classes used to evaluate if images are acceptable (do not show improper content, etc), and
to send them to S3.
"""
from
PIL
import
Image
import
urlparse
import
requests
...
...
@@ -9,6 +14,7 @@ import logging
log
=
logging
.
getLogger
(
__name__
)
#Domains where any image linked to can be trusted to have acceptable content.
TRUSTED_IMAGE_DOMAINS
=
[
'
wikipedia.com
'
,
'
wikipedia.net
'
,
...
...
@@ -16,15 +22,23 @@ TRUSTED_IMAGE_DOMAINS = [
'
edxuploads.s3.amazonaws.com
'
]
#Suffixes that are allowed in image urls
ALLOWABLE_IMAGE_SUFFIXES
=
[
'
jpg
'
,
'
png
'
,
'
gif
'
]
#Maximum allowed dimensions (x and y) for an uploaded image
MAX_ALLOWED_IMAGE_DIM
=
1500
#Dimensions to which image is resized before it is evaluated for color count, etc
MAX_IMAGE_DIM
=
150
#Maximum number of colors that should be counted in ImageProperties
MAX_COLORS_TO_COUNT
=
16
#Maximum number of colors allowed in an uploaded image
MAX_COLORS
=
20
class
ImageProperties
(
object
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment