Name of automatically generated placeholder img is too long

We created a few custom macros that help us with creating an elearning solution for a big client of us. We just found out that if Text that is saved in the macro exceeds a certain length it leads to an unsaveable macro.

We created the macros in a way that they include an editor-mask and don’t work with the component body since it is easier to read that out at another point in our workflow. Since the placeholder Image that is genereated includes the text that is being saved in that macro the text becomes part of the img name. Because we have a lot of special characters etc we decided to URL encode/decode the text that we input. Because of that each text gets significantly longer and once we reach 2160 characters before encoding it is unsaveable after encoding since the IMG is generated with a name that is several thousand characters long.

The img gets the the status of
414 Request-URI Too Large

The two questions that we have are:
Is it possible to disable the img-function that generates a placeholder image or atleast restrict that function so that not all the text is included?

And would a server Solution change anything? We are currently cosidering a self hosted confluence version and this could be what swings the opinion. Or is that something that is not impacted by server or cloud version?