Garry's Mod Wiki

Revision Difference

DImage:GetImage#513670

<function name="GetImage" parent="DImage" type="panelfunc">⤶ <ispanel>yes</ispanel>⤶ <description>Returns the image loaded in the image panel.</description>⤶ <realm>Client</realm>⤶ <rets>⤶ <ret name="" type="string">The path to the image that is loaded.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Creates a frame with a randomly chosen post process effect thumbnail and prints the image path to console.</description>⤶ <code>⤶ -- 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())⤶ </code>⤶ <output>⤶ ```⤶ materials/gui/postprocess/colourmod.png⤶ ```⤶ </output>⤶ ⤶ </example>