Set a background image using -Attributes - works from a URL, not locally

Edit: Solved: Set a background image using -Attributes - works from a URL, not locally

For the life of me I can’t get this working. I realize New-UDImage can create an image, but I need to set a tiling background. Seems like it should be simple, but this isn’t working. It works fine if i use a url instead of a path.

What am i missing?

New-UDElement -Tag 'div' -Attributes @{'style' = @{'background-image' = "url(./assets/prism.png)" } }

Are you using publish udfolder for the assets folder?

1 Like

EDIT: THANK YOU!!! @AlonGvili nailed it. I needed to add a published folder, then i could set the background locally with

"background"       = 'rgba(0, 0, 0, 0) url("/assets/prism.png") repeat scroll 0% 0%'

No, and i just realized that might be the problem. even the asset isn’t served via localhost:80/assets/image.png

I’ll look into Publish-Folder and report.

1 Like