DImage/GetImage

From Garry's Mod
Jump to: navigation, search
 DImage:GetImage( )

Contents

DescriptionPanelFunc

Returns the image loaded in the image panel.

Returns

string

The path to the image that is loaded.

Examples

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
DImage GetImage example1.jpg
Personal tools
Navigation