Questions are special, or at least the core question system provdies helpers on top of the standard uploaded file serving stuff that probably reduces the amount of work you need to do, once you understand it.
The core question types already support images everywhere. E.g. if you want a multiple choice question where all the choices are images, well, you can just do that with the standard qtype_multichoice.
Anyway, looking at the code of the question types already in Moodle is probably the way to work out what you need to do.