> Is there a way I can pass the InputStream of the image as an arguement to the ResourceProvider.
You need to reference somehow the image in the database from an HTML source. It is up to you: you may even implement a repository of InputStreams (which would be a quite strange architectural decision) and refer to them by a unique input stream ID:
In the resource loader you’ll receive “file:inputstream#4711” image URI to be parsed, to select the corresponding input stream and to read the referred image.
But of course a better approach is to specify in the image URI some unique key, sufficient to lookup and to read database image with your custom resource loader.