Gadget image handling
Helper function
Fixes
Merge branch 'image-handling'