Defining a PHP variable using a field
You could create a simple text field to store the string, and then a custom formatter to render it as an image. Then under "Manage display" for the content type, you choose the formatter you just created.

If you don't want to create the custom formatter programmatically, you could use the Custom formatters module.

If you want to use the value of the text field for more than one output element, you could create Display suite custom fields using this value e.g. as a token.