Dynamically generated MacroPlaceholder in Editor (Server)

Hello everyone,

i am trying to generate / change the macro placeholder dynamically after the user entered some value in the edit page.
It should work exactly like e.g. the status macro (example below).
I already managed to expand the property panel of the macro so that the user can enter a value.
What i now want to do is to create an image (if needed?) depending on the user input and replace the macro placeholder with that image instantly.

The tutorial (Providing an image as a macro placeholder in the editor) only shows how some predefined pictures can be displayed.
But i need to create the image depending on the user input.

The behaviour should be like in this Status macro:

Either generate the image and insert it into a DownloadableResource, then return the URL to that resource, or return the URL to a service that generate/return the image.