Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Firebolt93q · Mar 25, 2012 at 09:55 PM · imageserversavewwwform

A good way to save an image in Unity webplayer and send it to a server?

I am a junior programmer and my team and I are making a game in Unity for the web. We are using Unity webplayer to run it.

***The problem: For our game, we want to save an image/texture that a player made in our Unity game, send it to our server, then another player can retrieve it. We're not really sure how to save this image and send it to our server as an image file format. Our server is Heroku (using Ruby on Rails 3.1) and the server then sends it to Amazon S3 (storage site.)

We have an issue sending the image from a Unity wwwform to our server. Unity sends an image via a byte array, however S3 does not hold images as a byte array. It only holds images in regular file formats. We found some java code that can convert a byte array to a png, but our server is using Ruby on Rails 3.1.

***What we're thinking: One thing we thought to do is this: Is it possible to embed java code as a .jar file in the server and run it as an executable and send it off to S3?

As far as saving images locally to a user's computer, does this raise some kind of security issue or is there a way to bypass that?

We were thinking of using PlayerPrefs but that doesn't save images...

Any other input and ideas to solve our problem would help! Thank you!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by DaveA · Mar 25, 2012 at 10:23 PM

There is code here: http://unity3d.com/support/documentation/ScriptReference/Texture2D.EncodeToPNG.html If that's not working my guess is you may need to set some headers 'manually' using UniWeb

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by by0log1c · Mar 25, 2012 at 11:08 PM

Is there a reason why you choose to use Amazon storage service rather than your own webserver? I've done it before and the way I used is this, it might not be the only/best way but it works:

  • Setup a webserver allowing PHP. You may get a free one from many online providers.

  • Create a PHP upload script, W3S example here.

  • In Unity, follow the EncodeToPNG example to upload to the PHP upload script.

  • Fetch the image by creating a WWW pointing to the uploaded image with WWW.LoadImageIntoTexture.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I receive a WWWForm image using PHP? Example script 1 Answer

Can you change ScreenShotCapture Camera? 1 Answer

Base64 encoding always show white image on device. 0 Answers

How to save runtime generated texture in Webplayer to hard drive? 1 Answer

Is there any way to save image in Unity Flash? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges