I have a running website where i have images of products uploaded in a directory and the respective
images name in mysql database. Now, i have my mobile application (android) connected to my running website
database through an API that does the communication.
Technology used for my application development
1. Android Studio (IDE)
2. Retrofit for communication with the Slim
3. Slim for the API
4. Mysql for storage
ISSUES
Product upload is only allowed on the website.
How can i have access to the product images in the image folder of my running website to be displayed
on my android app through the API. Am only having access to the image name which was stored in the
database after product upload on my website.
Am i to have the whole image content uploaded in database using BLOB when uploading product on my
running website.
Please, kindly assist me in resolving this.
THANK YOU.
You don't want to store an image in the database as BLOB, now you are getting the file name using the API and you know the file stores server path, then you can achieve those images like this.
Here am using picasso image library to set your images to ImageView in android , you can use different tricks to set image.
String filename = "yourProductImageName.png" //this is the filename you get from api
String filepath = "https://yourDomin.com/imagesdirectory/" + filename;
Picasso.get().load(filepath).into(imageView);
Related
I have a folder on my computer with many images. I want to have my app be able to load all of these images into a View. I have no problem loading one image from its url (using Picasso) but I want to know how to load a folder of them (i.e the amount of images may change).
I was thinking that I could use a Google Drive public folder to store the images, but how could I get the images from within the folder (i.e if I had the folder's URL could I use Java to "open and look inside" it)? Is there a better (and free) way than Google Drive to store the images? Maybe an imgur album or some kind of free server hosting service?
You can use Firebase or Alternative use is Imgur . You store images there and the links of images tou can store in a db (sql Lite) and just add connection of db in main.activity Here you can learn how
You should consider using Firebase for this. Upload your Images in the Firebase Storage and store the link in the database. Once done, you can show all the Images in your app and also dynamically add the images.
I have encounter this issue recently while using Ionic3 to develop app on Android phone. I have cols and rows of data which I extracted into a 2D array. After which, I create a csv blob from the 2D array using papaparse.
let csv = papa.unparse({
fields: this.headerRow,
data: this.csvData
});
var blob = new Blob([csv]);
var a = window.document.createElement("a");
a.href = window.URL.createObjectURL(blob);
a.download = "confidentialData.csv";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
The code above works only for browser download, when I load it into my android phone, it does not download at all. I have read many other posts on how Ionic app download file into the device using FileTransfer and File. But I cant seem to work around with these because FileTransfer.download requires a url source in order to download the file into the device.
But for my case, the file is not hosted anywhere and the blob is generated dynamically from my code. Would appreciate any help or recommendation on how I can download my csv blob into my android device using Ionic 3. Thank you very much.
You are getting it wrong. FileTransfer works as an upload or download from an url (For example uploading a picture to a server from your device or downloading a picture from the server to your device).
What you want to look at is Cordova File and use the functions createFile and writeFile to save the data on the device.
EDIT: To save your file on the Documents or Downloads folder you will need to use cordova.file.externalRootDirectory + '/Download/' for it to work, also take in mind that a lot of folders are just read only (dataDirectory on iOS for example)
Hope this works.
I'm trying to develop an android app which displays the images stored in a database hosted on a server . As of now , i'm using Firebase , which supports only text and i'm storing the url of the image to be displayed in my app .
Are there any other options for me to store images on the internet and retrieve them in my App ?
You can encode the images themselves using Base64 and storing them directly. But what you are doing is usually the best option.
To learn how to encode images to Base64, see here:
https://stackoverflow.com/a/9224180/5935255
I am having an app requirements like whatsapp application. The thing is that webservices are not ready and it will take time. Meanwhile I want the test URL which use JSON format to upload and download the videos and images.
I know the sample URL's for JSON simulation
http://www.jsontest.com/
http://www.mocky.io/
For HTTP GET and POST simulation
http://httpbin.org/
Like this I want it for images and video in the form of JSON upload/download.
You don't need a webservice to test download from android, just a server container like tomcat installed on your computer and place files you want to download on tomcats directory.
But you will need one for uploading to receive (even if it does nothing).
You may use the following websites to download an image from
http://dummyimage.com/
Or this website
https://placehold.it/
You may also use the following website for video downloads
http://www.sample-videos.com/index.php#sample-mp4-video
i wanna display image saved on the D://foldername//foldername//filename from my computer on the android emulator using eclipse and also how to display it from a server?
as i am accessing the data from the server and also the images are saved on the server
Unless you're running a web server which provides public access to the image, I don't think you can display an image from your computer using a path like that. You either need to include the image in the assets or res/drawable folders within the app, or have the image accessible through a web server which you can load from within the app using the method described in this question.