Wagtailimages: Test image is now created on the fly

pull/81/head
Karl Hobley 2014-02-23 14:58:04 +00:00
rodzic 451f133d3b
commit f565f4b79b
2 zmienionych plików z 8 dodań i 1 usunięć

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 1.9 KiB

Wyświetl plik

@ -8,7 +8,14 @@ from wagtail.wagtailimages.templatetags import image_tags
def get_test_image_file():
return 'wagtail/wagtailimages/static/wagtailimages/images/test.png'
from StringIO import StringIO
from PIL import Image
from django.core.files.images import ImageFile
f = StringIO()
image = Image.new('RGB', (640, 480), 'white')
image.save(f, 'PNG')
return ImageFile(f, name='test.png')
Image = get_image_model()