fixes #4111 - Add image user data flag to API

fixes #4111 
@domcleal -- good point. refactoring.