[BUGFIX] Refactored building of the frontend environment to make use of getImgResource method.
This fix needs the latest pt_extbase version to work.

Also fixes forge bug #60083