Search code examples
androidpicasso

I need Picasso to load image from private folder of the server which does not have a URL address, how?


In an Android application, I normally load images from the server using Picasso with the URL of the image

In the server there is a folder (called public_html in my case)
If I was supposed to have a site then the Index file of the site would be placed in this folder. For example if the Domain name of the server is MyDomainName then
http://www.MyDomainName.com/index.php would be the home page of the site

If I create a folder called MyImages in the public_html folder and place an image called MyImage1 there, then the image is loadable by the Picasso with the following URL:
http://www.MyDomainName.com/MyImages/MyImage1.jpeg
So there is no problem with Picasso to load images from the public_html folder

The point is, the folders before public_html are not accessible by the users through URL
I normally use this area to put PHP codes so that they would not be accessible by the users
The Question is if a place an image in this area (folders before public_html) how can I load it with the Picasso?
In other words, Picasso needs URL of the image and the URL is prefixed with http://www.MyDomainName.com/ (which is public_html folder in fact) but my image is place outside the public_html folder
How can I work around such a case to be able to load the image with Picasso?


Solution

  • how can I load it with the Picasso?

    You can't directly because as you wrote it yourself, it is unaccessible. Your only way to get it over http is to have url that would expose these files. Fur your application It does not matter how it's done.