VoidUI.IconSelector is the powerful tool to allow quick and easy user images from Imgur. It contains a VoidUI.TextInput and DImage!
Derived methods and other information not listed on the page will likley be sourced from Panel.
This is used for a quick creation of UI it does not represent the function used to interpret the imgur link
local iconSelector = mainframe:Add("VoidUI.IconSelector") -- Add a IconSelector --- Learn more about mainframe: "https://wiki.voidstudios.dev/en/VoidLib/cl-voidui-frame"
iconSelector.textInput:SetPlaceholder("Hello") -- Access the interal textInput and add a placeholder
iconSelector:SSetPos(300, 225) --Set Position and scale it
iconSelector:SSetSize(300, 100) --Set Size and scale it
Below is the example where the raw function is used to get an imgur link (no user input)
local icon = mainframe:Add("DImage") -- Add a icon --- Learn more about mainframe: "https://wiki.voidstudios.dev/en/VoidLib/cl-voidui-frame"
icon:SSetSize(250,150) --Set Size and scale it
icon:SSetPos(300, 200) -- Set Positiona and scale it
local val = "tggnEUo.png" -- The imageID to fetch (https://imgur.com/tggnEUo.png) <-- only need the contents past the last /
icon:SetMaterial(nil) -- Refresh icon for change by setting it to nil
if (#val > 3) then -- Ensure is a valid link
icon.isLoading = true --bool to check if is loading
VoidLib.FetchImage(val, function (mat) --Run function
if (!IsValid(icon)) then return end --If the icon isnt valid, return
icon.isLoading = false -- Icon finished loading
if (!mat) then return end -- if the material is false then return
icon:SetMaterial(mat) --Set icon as image
end)
end