Reject image promise on error and add onload handler for none file urls.