As the title, I want to save my .png file to Orion. I tried to use binary file but I got an error due to fobiden character? So It is posible to save png file to orion. Is there a best practice for the case. Many thanks
if the image is not so big you can use a data URL
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
otherwise I would use an external storage mechanism and only keep in Orion a URL pointing to the object storage where your image is.
best
Related
Say I have an image image.png, and I run some object detection and want to save a json file with annotations as image.png.json. Is there any technical/OS/semantic issue with doing so? Is it considered widely as bad practice? I kind of like the idea of being able to recover the original file extension from the json file.
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 have a simple file browser that allows a user to select a local image, I want to manipulate this image before uploading to the server. The problem I'm having is that when I call fileReference.upload() it seems to upload the original file on the user's hard drive rather than the modified bytearray. Am I doing something wrong, is this expected behaviour or a bug?
As a very basic test if I do something like this I still get the original file:
// load the file in to memory
_fileReference.load();
// ... on file reference loaded
trace(_fileReference.data.length); // 230189
_fileReference.data.clear();
trace(_fileReference.data.length); // 0
// With this next line commented out I would expect a 0 bytes file, or an error or something, but instead it happily uploads the original file.
//_fileReference.data.writeBytes(myNewByteArray);
_fileReference.upload(myURLRequest);
According to this post Manipulate file data (byte array) this should work...
Any thoughts greatly appreciated!
Cheers,
Simon
Read the documentation of FileReference carefully. It says that data property is read-only. That means you cannot directly change an image before uploading it.
To change an image, you can use Loader::loadBytes() to get an instance of Bitmap, then change it the way you want, encode it and then upload to your server.
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.
how to add image file/s to mysql table.I am a programmer I am using php and mysql.
You shouldn't add the image itself for websites. You upload the image to the server and then save the path into the database. You should be able to then output the path of the file to HTML.
You need to use blob (or mediumblob or longblob depending on the maximum size of images you want to support) data type for storing binary data.
Before inserting, be sure to escape special characters in the binary image data.
$img_data =mysql_real_escape_string(file_get_contents($filename));
I usually store the url of the image file rather than the file itself (not too sure how you would do that anyway). I recommend storing the url and using