Garry's Mod Wiki

DImage:GetImage

  string DImage:GetImage()

Description

Returns the image loaded in the image panel.

Returns

1 string
The path to the image that is loaded.

Example

Creates a frame with a randomly chosen post process effect thumbnail and prints the image path to console.

-- Frame MainFrame = vgui.Create("DFrame") MainFrame:SetSize(200, 200) MainFrame:Center() MainFrame:SetTitle("Post process effect") -- Load post process effect thumbnail local postprocess = vgui.Create("DImage", MainFrame) postprocess:SetSize(128, 128) postprocess:Center() local materials = file.Find("materials/gui/postprocess/*.png", "GAME") postprocess:SetImage("materials/gui/postprocess/"..materials[math.random(1, #materials)]) print(postprocess:GetImage())
Output:
materials/gui/postprocess/colourmod.png