User:Megamatrixdude/How To Get An Asset's Image

From Legacy Roblox Wiki
Jump to navigationJump to search

How to get an asset's image

Since people on scripting helpers keep asking, I've decided to put this on the wiki.

The link to get an asset's image is as follows:

http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=420&height=230&assetId=ASSET&RAND=123456

You can change the height and width by editing the number after height and width, and change the asset by removing "ASSET" after assetId and pasting a valid asset. If you want a function to do this for you, then here you go (courtesy of Blocco):

Example
local baseTexture = "http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=%d&height=%d&assetId=%d";
function GetAssetTexture(aId, w, h)
	if aId == nil or type(aId) ~= "number" or (type(aId) == "number" and aId%1 ~= 0) then error("Bad argument #1 to GetAssetTexture (integer expected, got " .. type(aId) .. ")") end
	return baseTexture:format(w or 110, h or 110, aId);
end


> GetAssetTexture(1337, 100, 100)
http://www.roblox.com/Thumbs/Asset.ashx?format=png&width=100&height=100&assetId=1337


Now stop asking.

мεgαмαтяιx∂υ∂ε (TalkContributions) 20:00, 26 July 2011 (UTC)