add script callback for before image save and change callback for after image save to use a class with parameters