Display Record Image on Custom page in html widgets - Environment issue

Display Record Image on Custom page in html widgets - Environment issue

Hi,

I am trying to display an image from a record on a detailed record page.
The page is created with a html widget.

I noticed that the default retuned image url has to be processed.
Something like :

carImage.replaceAll("sharedBy","accountname").replaceAll("appLinkName","appName").replaceAll("fieldName","Fieldname").replaceAll("viewLinkName","reportname");

So far all works, but the image is not loaded on the page, probably since I am working in my develop environment

When i modify the url to the following it is loading/visible: ( i added the environment to the url )
/accountname/environment/development/appname/....

But this code will not work when I will push my code to live environment or test environment
How should I solve this?