Reputation: 17
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.
Upvotes: 0
Views: 73
Reputation: 779
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);
Upvotes: 2