Upload images without convert to string - java

I need to upload images and i want to show all of images in another page. I have tried to use volley, but it need to encode and decode to show all images. It made my application not responding when i decode all the string of images.
My questions are:
Are there any ways to upload images beside volley?
Are there any ways to upload images using volley without convert them to string (encode)?
Thanks

I implemented it once by positing multi part file using HttpUrlConnection.
Basically you provide the image file input stream, the desired file name and the file's MIME type.
You can access the source code through this link:
https://github.com/MinaSamy/DailySelfie/blob/master/app/src/main/java/bloodstone/dailyselfie/android/utils/PostMultiPart.java

Related

How to add a custom tag to a file (mostly images) which is uploaded to a server, and the tag is read through a php script to sort it?

When a file is uploaded to a php server, I am trying to figure out a way to get files sorted. What I want to do is add a custom tag to each file programmaticly in android, upload it to the server (which I have alreay done), and read that tag through a php script.
Thanks for the help
Exif seems to be the way to go for adding metadata to an image. See this related question.
I actually don't think this is the best way to solve you problem. You shouldn't modify the physical image just to introduce some ordering. What exactly do you want to accomplish? You just want to have the same order on the server that you had on the device? What about you send the order in a separate piece of data, say JSON or so?

Java agent to display dynamically generated graphic?

In Lotus Notes, I have a document that contains a PPT file attachment. Using Apache POI, I was planning to generate an image from a specific slide from that PPT and display it on the web browser by accessing the agent from the web probably with the use of Ajax. Is there a way to temporarily store the generated image and display it? If yes, how would you be able to do it?
You could achieve this even without saving the attachment by encoding it Base64 and embedding it in the source-code like this:
<img src="data:image/gif;base64,
R0lGODlhmwDFAPcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0N
DQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZGRoaGhsbGxwcHB0dHR4eHh8f
HyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygoKCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDEx
MTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkND
.... Lot of ascii characters ....
gww18FBEikHcgNkMRW5lmkJI/teaa0wNiOhshFFuiRSVpL34nqQRphZmcV5miORZQwnRpndI
nUmiiTStuaKbLl4Z45wuuADDDDfsgNKeMmy160w1hdaVSZfupyiXSgLoWpOQFjgpWUsKCGem
CEXFlIRlBefllxqKKlyblb45olWqosgmi29iGiudM+6Knp5F6LhrDYYCccQRQuzQp1cBAQA7">
If you need to store it, you could store it to a temp- folder and then attach it to a document. Then you could easily show it using an img- tag with src- url http://server/db.nsf/_/documentuniqueidOfSavedDocument/$File/nameOfImage.jpg

Find out the extension of an image, if that image doesn't have any extension

Our project has an image uploading module using Java. While uploading image, if a user uploads an image with an extension of jpg/jpeg/gif/png etc., whatever the extension, we save it with same extension by changing just its name.
But here is one small issue. Suppose the user removes the extension of that image manually (of course it never happens, but let's consider it as example) and uploaded the file, it doesn't have any extension.
Is there any way to find out extension/format after reading that image (like after reading the image using getBufferedImage())?
Here I can't use mimeType as we are taking mime type from user while uploading image itself. The user may upload image without an extension, by selecting the mimeType as "image/jpeg".
There are java libraries like mime-util or jmimemagic that can detect the file type from the pure content.

Java Appengine: How to store a transformed image back to blobstore

I'm able to
-Upload an image to the blobstore
-Transform this image (in my case rescale it)
But I don't seem to be able to find out how I can store the transformed image back to Blobstore.
Any ideas?
BR,
As far as I know, this is currently only an experimental feature. You can create a "file" using createNewBlobFile.
Get more information here: Writing Files to the Blobstore (Experimental).

Fetch Image and Save To Google App Engine Using Blob

I have image URLs like http://example.com/someimage.png - how do I fetch that image and save it with Blob? Thanks.
Here's example code from the documentation showing how to write a file to the blobstore. You'll have to use a stream instead of a writer, since a PNG image is binary, and you'll have to set the appropriate content type, but it should show you the way.
And here's the UrlFetch documentation, explaining how to get some available resource on the web, using HTTP.

Categories

Resources