I am a complete novice, doing some work on a HTML5 drag and drop game. I am looking at coding tutorials which will save an image of the game when the user presses a button. The canvas image is saved as a DataURL. I kind of understand what this means. But my questions are: where does the image save to (as you don't seem to need to specify a location) & will an image saved to that location always have a unique URL (i.e. images saved from different games wont overwrite).
The Data Url is just a Base64 encoded string which represents an image. I'm not sure about your exact implementation, but you almost always would have to save that string at some persistent location. Try the Local Storage for instance if you want to save the image on the user's machine and not on a server.
Otherwise, you can always POST the Base64 encoded string via Ajax to your own server and save it in a file or database.
Related
How can I insert an image data in MySQL Database and then retrieve it using Golang?
Basically I want that task for upload profile picture of user in web application.
According to the my knowledge,the best solution is save image as blob object in database.Is it best solution for upload image in webapplication in golang.?
Please help me find the best solution for that.I want to find the solution in golang.I am beginner for golang programming.
converting image to a blob and save it in the database is a somewhat long process and it may cause issues sometimes. The easiest way is saving the image to a server (or a local directory) and saving the image path in the database. In that way we can access the image by using the image path in the database. This, will show how to save image path and access it and converting image to a blob and save it in the database.
Here
I'm working on an application that would allow users to create a custom character sheet for role play games. I have most of the code figured out, but I want users to be able to send their character sheets between devices.
So here's the question: is there a way to save and send a shared object file, or a way to create a txt file that can easily be saved and copied?
I don't believe you can send a SharedObject from one device to another, at least without a lot of work. You could however create an XML file containing the data and save that up to a server. You could allow the user to then download character sheets from your server and the app would read the XML data before converting to a SharedObject. Can't really provide any code for this as the details are lacking.
If I understand you correctly, you could sort of do this.
You cannot literally "send and receive" a SharedObject (well, you might be able to copy your shared object data on the file system directly, but not from Flash).
What you can do is provide options to the user to save and load a file that encodes all the shared data in AMF bytes. Here's the general idea:
First you need to give the user an option to save their data. You can use ByteArray/writeObject() to write your data using the same AMF format that SharedObjectuses, and FileReference/save() to allow the user to save it to a file on their file-system.
Next, you can use FileReference/load() to load the file and ByteArray/readObject() to read all the data into AS3. Now you can simply store it in the SharedObject however you want, just like you did before.
I use Access 2007
I have created an OLE field to store JPEG, so I can easily drag them into DATABASE.
That works. Trouble is: This field does not dispaly the JPEG but the generic JPEG thumb and I need to double click to open the JPEG and preview it.
Is there a way to preview JPEG without having to double click on it ?
regards
Have you considered storing your images entries for your database as 'text', and simply store the path for the image(//pics/mypic.jpg), rather than the image object itself? If your database is on a shared drive, you can create a folder in the same folder as your database to hold your images. When inserting an image, you can have a textbox and simply type the relative path to that image. This will prevent your database from inflating in size. From there, it is just some simple code to display the picture.
After setting your database up to just store the path names of the images, you can follow these easy instructions on how to display these images on forms : Microsoft Knowledge Base
I recently switched a couple of my databases from using OLE's to text fields with the path name of the picture and am really satisfied with it.
You will need to use an Attachment data type to display anything other than bmps. Only bmp images will display in an OLE field (see the Northwind sample database for an example, the Employee form shows bmp images stored in an OLE field).
Alternatively, you can store the path to the image and show it in your form with some VBA. In general, it is best to store paths to images, rather than images, even with databases that have much higher size limits.
I am trying to write a mp3 player using HTML 5 benefits. Play local file, until now, seems ok. Im writing sample codes based on these example : http://antimatter15.github.com/player/player.html
Here's the thing : I have to get the reference of each mp3 file. I want to get all this reference and save on database for when the client access the website i show this playlists. The problem is : doing in that way I mentioned before every time that client close/open browser the blob reference to file is not valid anymore. Iam looking for FileSystem API, that allows to save data into sandbox section. So, data could be cleaned every time users wanted and im still cant save mp3 references on my server database. Could you guys give me sugestions? The real thing is just save a reference from mp3 local file to allow my user create a playlist and every time that he access the web page he could see that playlists.
Thanks in advance,
http://www.html5rocks.com/en/tutorials/file/filesystem/
I doubt this reference(or "object URLs") persistence thing is intentionally unsupported by the browsers. Otherwise you could access the user's filesystem without his awareness. This could be a security problem.
As quoted at here:
Each time you call window.URL.createObjectURL() , a unique object URL is created, even if you've created an object URL for that file already.
(I am sorry if my question is not in the right place. (I've been thinking for awhile and came up to the conclusion that this one is the best place for my question)
Is it possible to create such an HTML web-page that would provide a user to download a certain file from it, but would not disclose the location of that file (i.e. the user would not know the URL of the file that he is downloading).
If yes, would you, please, give me some directions as to which HTML code I should use to create such a page.
The HTML page would provide a link to a server side script passing a filename or other unique moniker:
Download Now
The script would read the identifier, derive a full path from it, load the file and write it back with the appropriate headers/mime type causing the browser to prompt the user with the normal download dialog.
The only location data available to the user would be the link to the script - which would - unless you add some security - serve back the file just as if it were a standard url pointing to a file.
(PHP Example)
With pure html, no. But with a serverside script (php, c#, vb, perl, or other) yes. You would stream the file to user. In that case just the serverside script has access to the origin files