android: get thumbnail from blobstore image - android

I have an appengine connected android project. It's using endpoints. Anyway, I have some images in the blobstore. The android app has the url to each image. Normally, android needs a full image. But for my GridView I want to display a number of thumbnails. I know how to fetch images from a server (here the blobstore). My question is, is there a way to ask the blobstore to send me a thumbnail of an image? The call needs to come from the android side.

You could use get_serving_url()
You can use it to generate a link to the image in the blobstore and can specify the size of its "longest dimension ... preserving the original aspect ratio":
images.get_serving_url(your_blob_key,size=300)
This will produce a URL like this: http://lh6.ggpht.com/iQLnaVoMEhOWzMummf_PzD8frysTBIP6FsTCYpEuf0FA8KaK72T0zreND_pi4vZyUJQvv72x_rXLisIJOiXbb2IWzBc=s300
As you can see, setting size=300 simply adds =s300 to the end of the URL, so you could skip adding this and just add =s300 to the url in your app.
Be aware that this creates a "Public but not guessable URL". This essentially means that anyone could potentially access the link generated if they have the URL.
The other issue with this is that you would need to generate the link from within App Engine. However if you NEED to be able to just access it directly through the app you could generate the link during upload and store this in the datastore along with the blobstore key. You could then send this link to the app, in-place of the existing link being sent.

Related

Post an image along with text in django restframework with flutter

I am creating a b2b e-commerce mobile application. I am using flutter as frontend and django for backend. I am stuck while sending a post request to django server with flutter. The case is I have two types of user. They are seller and buyer. The seller has to post product in the app. Model field for product are title, description, price and image. I created post method in django rest framework and it worked while checking through postman. But I am having hard time sending image through flutter. I used image picker to get the image. I searched for many things but could not figure out what to do. I found articles and videos posting only image at a time but i want to send image along with other text field. How can i do so??
Help me find a solution.
It is better that you upload your selected image with multipart and separate api, but if you want send image with other info , you must, first decrease quality of image until request time was decreased(don't receive timeout api), and also use base64 for this.
Key word for searching for more info, upload image with base64

How to take an image as an input from the user and view it in the database w/ Android Studio

I am trying to create an app using Android Studio. My client wants to create an app for their online medicines website, wherein the user can take a photo of their prescription, the photo will be accessible by the admins and they can use that image to understand what does the user require and deliver those medications at the user's doorsteps.
So can anyone please guide me through with making this page, or maybe share a link where the making of such a page is shown? Would be really helpful, thank you for giving me your time.
There can be several possible approaches for this type of questions/requirements. I am mentioning a few steps to guide you through the process.
You will have to create a webserver, which will be storing the user data (profile, uploaded prescriptions, etc.). The user data (textual) will be stored in the Database, however, the images will be uploaded in a directory over the server, and their corresponding links will be stored in the DB for reference.
There will be a webserver API which will fetch user data (user unique ID) from app and then store it in the DB. The image part can be accepted in several ways: MultiPart, Base64 encoded, Byte Array Converted
All these methods will send the image info from the android app to the webserver, which will follow the logic mentioned in Point 1 and save the image.
The Android app will have an activity where the user will either capture an image of the prescription form, using Camera, or can upload the image (if already captured/downloaded). You will have to learn doing this from similar links as these:
https://developer.android.com/training/camera/photobasics
Dialog to pick image from gallery or from camera
The Android app will send the unique ID of the user, along with the image data, to the Webserver API, which in-turn process as per Point 2.
You can start implementing the process and then can turn up to StackOverflow again for guidance. There are numerous tutorials to implement a similar functionality too.
https://www.simplifiedcoding.net/android-upload-image-to-server/
http://programmerguru.com/android-tutorial/how-to-upload-image-to-php-server/
https://www.codepool.biz/take-a-photo-from-android-camera-and-upload-it-to-a-remote-php-server.html
All the best!

How to get a url from a pin that can be opened on a webview

I am using the Pinterest Android SDK to authenticate and read pins from Boards I follow.
The issue is in my app, I need to to open the URL of the pin in a webview to able to read the pin contents in my app itself without leaving my app.
Currently, I can use the "url" field from the getPin() API response json, but the URL redirects from the webview to the pinterest app (leaving my app).
Is there a way to do this?
Thanks.
do you intend to show the entire pin or just the image? If you use the URL of the getPin() API then it is the URL to a "Pin" which is a Pinterest object and will always have a "Pinterest.com". Hence it will redirect itself to Pinterest app, which is the correct behaviour.
However, you can get the URL of the image from the Pin that you retrieved using getPin and display that within the app.
The other problem with your approach is that it tries to replicate the behaviour of Pinterest itself which is in violation of Pinterest policies and they may ban your app. So my suggestion would be to use the URL of the image of the pin and display inside an imageview of your app using Picasso or Glide.
All the best...

how to encrypt URL in android

I am very new to this concept ,when i share my image and text to other app,my domain name was visible but i want to encrypt it and when user click that link it should be redirect to my play store app URL ,i google it but I am getting any solution for ,i saw this functionality in many app please help me how to d this here below one of the app show like this i need to encrypt and redirect to play store without opening that URL i need to redirect to play store please any one help me how to do that,here below one of the app using like this encryption and redirection with out showing their Main URL .
Here below the Image
What you see in the image is not encrypted. It's an url Shortener. And in this case it's from google. Documentation about the Google URL Shortener
I think to make safe calls you need to encrypt it while sending and when user click on that image now you want to redirect to play store URL, so now decrypt it.
I found one library to do this job below is the link for example
https://github.com/simbiose/Encryption/blob/master/Examples/Android/app/src/main/java/se/simbio/encryption/MainActivity.java

Need to implement an image selection dialog of web-based images

I am developing a chatting/messaging app and I want to let the user select an image that they've stored online (i.e. picasa, photobucket, flickr, etc) which will be shown as part of the chat User Interface for anyone that is chatting with the user.
For example:
User_A is messaging/chatting with
User_B.
User_B will see a small thumbnail
image of User_A
User_A will see a small thumbnail of
User_B.
note: my web server is facilitating the text exchange between the two users.
At first I thought I would implement a photo upload function in my app and store the photo's on my server that each client would download. But then I realized that this is just re-inventing the wheel because there are now a lot of online picture sharing services.
So I want my server to simply store the URL of the images that User_A and User_B have selected - my app is notified of the URL's and downloads the pictures.
However, how is this implemented ? (Specifically, the image selection to obtain the URL in a userfriendly manner)
I've visualized the following userfriendly use-case...
user opens the options activity in my
app and pushes the button to select
an image to present in the chat UI.
an intent dialog is shown with all of
the possible image hosting services
installed on the mobile phone
(picasa, photobucket, etc) - but
local storage shall not be shown.
the image picker of the chosen
application is shown and the user
chooses the image.
the image picker closes and returns
the URL to my app.
If this can't be implemented, then my only alternative (that I know of) is to have users copy'n'paste the URL of the image they want to use - which is not userfriendly on mobile devices.
Any help is greatly appreciated.
That doesn't seem very difficult to me.
You can predefine which Image hosting services you wish to use.
Picassa and Flickr have their APIs AFAIK.
Present user with an option to choose from your predefined offerings.
When they choose, present the album of the user.
When the user ends up selecting an image, Image hosting will let you know about their URLs (You can download all images of that album and display them natively in your app, it will fetch information about them, like their URL with them, which will be easy to track)
Get the URL, and update the chat webservice about it.
Create the Chat activity in a way that it polls your webservice after a particular interval to check whether any one of both the users involved in chat have changed their images. If they have, load the new one.
I can detail you on this if you have any doubts.

Categories

Resources