How do I Share an Image in Multiplayer Chat Room ?

  • I want my players to be able to share images in chat room, but i cannot find a way in the forums!

    How can i do this? or Is this even possible???

    Thank you

  • Anyone having any idea?? please share!! we can make this work ,just have to find a way around

    Thank you

  • Im not to sure about this but I would love to know how to implement this aswell!

  • I would love to know this aswell I posted something aswell so we can get an answer.

  • Thanks LaurenceBedford

    Can you please PM me ASAP when you find an answer!

    Thank you

    • Import your image I assume you import the image with a file chooser object. If so, after importing, you will have the File URL available under the FileChooser.FileURLAt(index) expression. Use this in the Sprite action Load from Image URL to load the selected image to the Sprite.
    • Share the image The Sprite that you loaded the image to should have the behavior SpriteExt by

      rexrainbow or anything similar to access the Base64 DataURL of the image.

    With the Sprite expression Sprite.SpriteExt.imageUrl, you can now access the actual image.

    You can now send what this expression returns to your chatroom and anyone who receives it, can use the Sprite action Load from Image URL with the Base64 Data URL to load the Sprite with that image.

  • randomly

    Thanks for this idea!

    I will try it and come back with results!

    Thanks again

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • randomly

    I don't think this is going to work as the receiver is not making an image out of the Sprite.SpriteExt.imageUrl

    Here i made some changes in chat room example....

    https://www.dropbox.com/s/ke8s4o2v19e3759/chatSpriteSendTst.capx?dl=0

    My events are first two in common group,

  • Right, so here are several reasons why this doesn't work:

    • To use Sprite.SpriteExt.imageUrl (i.e. to make it return something), the Sprite actually has to contain something, meaning, you have to wait for On image URL loaded. After that, you can use it.
    • You can only load data URLs (the SpriteExt expression) to load Sprites from URL, not for Textboxes
  • Thanks Random

    I see what you are saying there so i tried using

    On Image URl loaded >> set text and

    when i click send it sends a really huge message after which the host automatically lefts the chat room???

    WHy is that so???

  • PS : Random

    Just found out it works on small images (which by the way is also giving a huge chunky url)

    but when i choose a big image file, like a screenshot from my mobile.... the host keeps leaving the room

    Can we fix this??? because its really important to share screenshots, right?... that's the whole point!!!

  • At which point does the host leave?

    When you choose the image from the File Chooser or when you send the Data URL?

  • At which point does the host leave?

    When you choose the image from the File Chooser or when you send the Data URL?

    When i send the data url of a large image!!! like a screenshot image,

    but if i send data url of a small imag say 100x100, it is sent alright!

    PS : randomly Also could you please help me in this-

    Please!!!

    Thank you

  • I don't really know anymore.

    One last idea would be to compress the string before sending it.

    Try this plugin.

    • Compress the DATA URL
    • Send the compressed string
    • When receiving, decompress
    • Apply to Sprite
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)