Created
March 2, 2012 17:01
-
-
Save zodman/1959668 to your computer and use it in GitHub Desktop.
Validator image width and height
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.files.images import get_image_dimensions | |
from django.core.exceptions import ValidationError | |
HELP_TEXT_570 = _(u"El tamaño debe ser 570px y altura variable.") | |
HELP_TEXT_604 = _(u"El tamaño debe ser ancho 604px y altura variable.") | |
def validator_570( image ): | |
w, h = get_image_dimensions(image) | |
if h != 570: | |
ValidationError(HELP_TEXT_570) | |
def validator_604( image ): | |
w, h = get_image_dimensions(image) | |
if h != 604: | |
ValidationError(HELP_TEXT_604) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment