ID:1321280
 
Code:
var/icon/I = input("Choose an icon for [src.name] from your system","Change Icon") as null|icon
if(!I)
return
/*// If the icon/picture is bigger than roughly 50.1 KB (the decimal to give a little headroom)
if(length(I) > 51303)
Display_Admin_Announce(usr,"Sorry, but pictures over 50 KB are prohibited.")
return*/

I.Scale(50,50)
src.icon = i


Problem description:
So since apparently I can't resize images for buttons, I'm trying to instead automatically force a scaling of the image upon upload, and yet for some reason it's returning a runtime error of:

runtime error: Cannot execute null.Scale().
proc name: Change Icon (/obj/Base_Character/proc/Change_Icon)
usr: Darth_Chaos7 (/mob)
src: Hai (/obj/Base_Character/Character)
call stack:
Hai (/obj/Base_Character/Character): Change Icon()
Hai (/obj/Base_Character/Character): DblClick("Players Online", "InfoWindow.info1", "icon-x=58;icon-y=10;left=1")
an icon file is not an /icon object.

You have to create an object, using icon(), or /new:
var/icon/I = icon(input("Choose an icon for [src.name] from your system","Change Icon") as null|icon)


This is an option.
Alright, thanks, I didn't realize that. @_@
Does the icon proc not work with jpg/jpeg files? It seems as though it sets the icon as null.
Should work fine...?

    icon_test()
var/file = input("Choose an icon for [src.name] from your system","Change Icon") as null|icon
var/icon/I = icon(icon = file)
I.Scale(50,50)
src.icon = I
world << icon


This works fine for me with gifs, jpegs, etc.
I think it was a cache error, since it can happen if you have the icon uploaded on another server.