Ingame Screenshot Shareing

Inspired by Metastructs one(and havent found a much better name :P) but greatly improved in every way I could think of.

http://i.imgur.com/ie2pQ2g.jpg[/T]
-can drag from and in any direction
-composition lines (golden section)
-mouse horizontal, vertical line to better position your box
-internal keybinds that would open the capturing screen in any menu

[T]http://i.imgur.com/Pd00mgl.jpg[/T]
-sharing menu to see who its going to receive
-enables you and anyone you wrote after the name after the command automatically
-(sending it to you obviously wouldnt send it through the network, just for saving purposes)

[T]http://i.imgur.com/LYWKmzx.jpg[/T]
-small download(blue) and upload(orange) progress icons in the top left
-feedback when you get an image, when the recipient got it and opened it

**Ok till here nothing too new BUT:

[T]http://i.imgur.com/Un7pXSi.jpg**[/T][T]http://i.imgur.com/LaFf5EP.gif[/T]
-full inbox to view,save,share*,delete the images
(*not back to sender, yourself or persons you already shared it with)
-shows info about size and quality (which wouöd be adjusted if the server sets partsize and part amount limits too low)
(95% seems to be the greatest quality the html can show)
(part delay also configurable)
-green are the screenshots you sent to yourself(saved) , from others would be blue

[T]http://i.imgur.com/0BH7GC0.jpg[/T]
-can close the image through the inbox for comfort
-closes all open when inbox is closed

[T]http://i.imgur.com/4t1RNIZ.jpg[/T]
-scaleable with preserving the aspect ration

[T]http://i.imgur.com/9iom4lM.gif

-can also left click to load and open the image

Any thoughts? Improvements? Ideas?

P.S. In this picures I made it send it to me through the server to show you how it looks.

Sharing*

How the hell did you get the image to send to another client without using the net library?!

I’m trying to make a messaging addon (completely based on iMessage, but for gmod) and I’m trying to incorporate this kind of thing into it (since iMessage has a photo-sharing option), but I’ve only got it to send half the image before it hits the net library’s max size limit, and it lags the server insanely while sending. How the hell did you manage this without the net library???


EDIT

For the people who rated this dumb, I thought that the point in the OP:

Was referring to every image sent, not just to the original client.

I am 99.9% sure he’s still using the net library, but properly.

I think, you split the img base64 into 1024 pieces (writestrings limit?) then you send int, how many pieces did you get from the base64 and write them in the pieces. When you are receiving you get the int, do for loop and combine the strings and you get the base64, use html then to show it.

Almost exactly what I’m doing. I used file.Read on the image, then split it with this function:



local function SplitStringEvery(str, count)
    local tab = {}
    for x in string.gmatch( str, string.rep( ".", count - 1 ) .. "?.?" ) do
        table.insert( tab, x )
    end
    return tab
end


Then I started the net library stuff- first I used net.WriteFloat to write how many times it needs to loop (the length of the split-up table) then for each value in the table, I send it with net.WriteData, and then when I receive it I don’t choose the option of using HTML, instead I use file.Write to save it as a temporary text file (using a handy Material exploit):



local function MaterialData( txt, format )
	return Material( "../data/" .. mat .. "
."..format )	
end


To load it as an IMaterial, before removing the file. But, only half the image gets sent (yet it still loads for some reason) due to something I don’t know of.

Here’s my full code(for the sake of RobotBoy hitting his head on the wall in disappointment of the GMod community’s average IQ).

[editline]20th October 2015[/editline]

By the way, heads up to the creator, that text file exploit might come in handy for less HTML stuff.

I think your problem is with the writedata. Shouldnt it be writetable as you have table? When i get home i could try to make this kind of stuff. And you should use DHtml with GetHTMLMaterial to show it and save it in base64. And make the render capture? (In my opinion)

[editline]20th October 2015[/editline]

Or you can use your own webserver, make php upload the pic and watch it from dhtml

I guessed WriteTable might have a data limit as well (but I might be wrong).

I split the data into parts and send it through net.WriteData the parts size can be like 64k(-some for entity and id included in the netmessage)

because of the limit of strings i can save to a file in a with util.tabletokeyvalues is 4095
this is how i split the strings for file saving its essentially the same as i do with the netmessages but this part is coded more simple:


for I = 1, math.ceil(datlen/4095) do
    tc.data* = string.sub(alldata,(I-1)*4095+1,I*4095)
end

EASY MODE:

for I = 1, math.ceil(LengthOfTheString / LengthItShouldHave) do
    Table* = string.sub(TheString,(I-1)*LengthItShouldHave+1,I*LengthItShouldHave)
end



at the moment its the datas length is 2^15 with a maximum of 1000 parts
if i set a pats length to 1024 is effectively the same as net.writestring
and every netmessage has a delay of 0.2sec.

with this settings a fullscreen(1920x1080) image at a quality of 95% (html wont show 100% at this size)

yes every netmessage has a limit of 64kb (2^16?)

EDIT:

This looks quite inefficient.

  1. string.rep( “.”, count - 1 ) writes a string of length n
  2. goes through with gmatch, an algorithm that compares both strings bit by bit and copies the needed part bit by bit.

Mine just counts the strings position and copies the needed part bit by bit.

Thanks for the better string splitting function, but any ideas on why my code only sends half the image? (Sorry if this is a dumb question but I’d really love an answer)

There are no dumb questions imo. I think you hit the limit of the netmessages size of 64kb.
I make entirely new netmessages for each part and send them with a delay(if you dont your client gets reliable channel overflow error-spam and a timeout from the server).
I send my parts of ~32kb with a delay of 0.2sec.

To connect the netmessages each one comes with an key. the key is made of the sender entity(or steamid idk) and an id(evertime i send an image the id increments on my client).

Does this answer it?

I was afraid the solution would be something rather annoying to code like multiple net message-receiving, but that makes sense, I guess.

Have you thought about saving the image strings to a text file (with file.Append so it doesn’t do it all at once) and then doing the material thing from before rather than opening it in a HTML panel (or is that what you’re already doing, I don’t know)? It’d probably be possible to see images in 100% resolution if you did that (although I don’t know if IMaterial lowers the quality or something).

Hm interesting thought. But the problem is not that I can’t write a lot of data into a textfile. It’s the function that converts a table into text that can only handle smaller strings. So I split the long string into many small ones inside that table in order to make it work. The textfile does not only contain the image. Also width,height,quality,timestamp,senders name and steamid and ofc the table containing many strings.

EDIT:

I send the image data first then encode because base64 makes the data a lot bigger.
With WriteData you dont have the strings limitation but the netmessages limitation.

I got 42 lines of code (+ 24 for sv) for a system, that screenshots the whole screen in full quality.
Just setup a webserver, if you configure it right, you can take screenshots and fastly just send them.
And now i can create screenshot gallery :smiley:
The only problem will be spam limitation though, and you dont have to force clients to download screenshots.
I could optimize it to load alot of faster if i would not be lazy to setup some faster img loading…

Can’t you just use

render.Capture

Yeah, i use it, then it uploads the data to webserver.

Looks pretty cool!

This would be great for an admin mod as well, so you can prove that people are using ESP and actually have a saved screenshot of it.

Thanks! I actually had it in but took it out for many reasons. As admin I’d turn on my own ESP and spectate him and ban if it’s too obvious.

Ah sry if it was unclear. I meant if I choose to share it with myself it just gets directly written to my inbox without any netmessage involved. If I also share it with others it only gets sent for them I still just save it directly.

The only reason that really justifies a dumb rating in this post for me really is the all caps quoestion. It gives me the impression of talking to someone really immature which you have proven not to be.

And how are you uploading it? Are you using the same way as the OP or is it something to do with the web server’s configurations?

I just setted up webserver, with post limit higher than default that allows me using glua’s http.Post send a lot of data, and then i just use php’s uniqid() which creates me the files name and insert the data and make it jpg, then i return the full url to the pic and now the client knows the url of the pic, so he can just send it to target. It goes pretty fast, but the only problem i have with it, that you can spam my drive… Maybe i just should get the clients ip, and check if he has uploaded in a hour more than 10. Then i just can manage it easily myself.