wagtail / wagtail-factories

Factory boy classes for wagtail
http://wagtail-factories.readthedocs.io/en/latest/
MIT License
102 stars 40 forks source link

Using real images #27

Open Pomax opened 4 years ago

Pomax commented 4 years ago

Is there a way to have the image factory use real images, rather than solid color fields? Wagtail has lots of different crop/focus/fill/etc rules for its {% image ... %} tag that can't be tested with solid colors, so being able to specify a real (set of) image(s), either static or from the actual CMS, would be incredibly valuable.

(maybe it's something that actually already works, only requiring a set of options to be passed into factory_boy?)

easherma commented 4 years ago

@Pomax factory_boy has 'from_file' as an available parameter: https://factoryboy.readthedocs.io/en/latest/orms.html#factory.django.ImageField

There's an idea here for using a collection of demo images: https://github.com/FactoryBoy/factory_boy/issues/576

Something clever with 'from_path' and an online image library might also do the trick?

Some problems with either of those approaches, but hopefully that can give a sense of some possibilities.