DImage Not Working

I’ve been trying to use DImage and all it is giving me is the purple+black texture. I am working with trails.

[lua]local back = vgui.Create(“DFrame”)
back:SetSize(500,600)
back:SetDraggable(false)
back:SetTitle(“Previewing”)
back:Center()
back:MakePopup()
back.Paint = function()
draw.RoundedBox( 8, 0, 0, back:GetWide(), back:GetTall(), Color( 0, 0, 0, 255 ) )
end

print(trl)
local imgb = vgui.Create("DImage", back)
imgb:SetMaterial(trl)
imgb:SizeToContents()[/lua]

[lua]local back = vgui.Create(“DFrame”)
back:SetSize(500,600)
back:SetDraggable(false)
back:SetTitle(“Previewing”)
back:Center()
back:MakePopup()
back.Paint = function()
draw.RoundedBox( 8, 0, 0, back:GetWide(), back:GetTall(), Color( 0, 0, 0, 255 ) )
end

print(trl)
local imgb = vgui.Create("DImage", back)
imgb:SetImage(string.sub(trl, 0, string.len(trl)-4)) --string.sub to remove the .vmt ending
imgb:SizeToContents()[/lua]

Neither of these work, and the print(trl) prints back a trail. (note the actual .vmt is not what is causing the problem, i have used util.SpriteTrail and it works fine with the trail)

Any help is appreciated

edit:

It seems I found the problem. I had to strib.sub out the materials/ part of it, but it’s working now.