Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if tArgs[2] then tArgs[2] = tArgs[2] + 0 end
- if tArgs[3] then tArgs[3] = tArgs[3] + 0 end
- if #tArgs > 0 then
- if #tArgs == 2 then
- scaleW = tArgs[2]
- scaleH = tArgs[2]
- elseif #tArgs > 2 then
- scaleW = tArgs[2]
- scaleH = tArgs[3]
- else
- scaleW = 1
- scaleH = 1
- end
- if scaleW <= 0 then
- scaleW = 1
- end
- if scaleH <= 0 then
- scaleH = 1
- end
- local response = http.post("http://www.lozengia.com/tmas/Downloads/Minecraft/computercraft/CCimage.php", "image=" .. tArgs[1] .. "&scaleW=" .. scaleW .. "&scaleH=" .. scaleH)
- if response then
- while response do
- local sResponse = response.readAll()
- response.close()
- shell.run( "clear" )
- cache = shell.resolve( "image.nfp" )
- local file = fs.open( cache, "w" )
- file.write( sResponse )
- file.close()
- response = nil
- term.redirect(peripheral.wrap("right"))
- local image = paintutils.loadImage("image.nfp")
- paintutils.drawImage(image, 0, 0)
- term.restore()
- end
- else
- -- if image is not reseved
- print( "Error, Could not load image." )
- end
- else
- print("syntex 1: httpimg url")
- print("syntex 2: httpimg url scale")
- print("syntex 3: httpimg url scaleW scaleH")
- end
Add Comment
Please, Sign In to add comment