Wednesday, February 12, 2014

Ask efficient way to get FTP pictures


            
Recently made an application: mobile phone to upload pictures via FTP server, and get a list of pictures by mobile phone photo management, relatively delete, sort, and so on!
For example, when you get the picture on the server are downloaded directly to the phone or by what method to efficiently!
To achieve this function perfectly! I was wondering what your thoughts are?
Points is not enough I can add!
Reply:
This is how the altar, nobody fertilizer complex!
Reply:
FTP download a picture show again? Unfit to do so, the phone's memory and storage will not stand, if concurrent access to a lot of words, FTP services can not stand.
LS can achieve another idea: Http to show through.
Ideas are as follows:
1 built HTTP service, the picture file resources placed under the HTTP service path for HTTP Client Access;
2 files added in the layout ImageView controls;
3 In the AndroidManifest.xml file to add network access:

4 In MainActivity add the following code:
 
ImageView imgView;

@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);

imgView = (ImageView) findViewById (R.id.imgView);
imgView.setImageBitmap (getBitMap ("http://XXXX.com/your.jpg"));
}

public Bitmap getBitMap (String imgUrl) {
URL urlImg = null;
Bitmap bmp = null;
try {
urlImg = new URL (imgUrl);
} Catch (MalformedURLException e) {
e.printStackTrace ();
}
try {
HttpURLConnection conn = (HttpURLConnection) urlImg
. OpenConnection ();
conn.setDoInput (true);
conn.connect ();
InputStream is = conn.getInputStream ();
bmp = BitmapFactory.decodeStream (is);
is.close ();
} Catch (IOException e) {
}
return bmp;
}

Reply:
reference to the second floor yxinf reply:
FTP download a picture show again? Unfit to do so, the phone's memory and storage will not stand, if concurrent access to a lot of words, FTP services can not stand.
LS can achieve another idea: Http to show through.
Ideas are as follows:
1 built HTTP service, the picture file resources placed under the HTTP service path for HTTP Client Access;
2 files added in the layout ImageView controls;
3 In the AndroidManifest.xml file to add network access:

4 In MainActivity add the following code:
 
ImageView imgView;

@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);

imgView = (ImageView) findViewById (R.id.imgView);
imgView.setImageBitmap (getBitMap ("http://XXXX.com/your.jpg"));
}

public Bitmap getBitMap (String imgUrl) {
URL urlImg = null;
Bitmap bmp = null;
try {
urlImg = new URL (imgUrl);
} Catch (MalformedURLException e) {
e.printStackTrace ();
}
try {
HttpURLConnection conn = (HttpURLConnection) urlImg
. OpenConnection ();
conn.setDoInput (true);
conn.connect ();
InputStream is = conn.getInputStream ();
bmp = BitmapFactory.decodeStream (is);
is.close ();
} Catch (IOException e) {
}
return bmp;
}

HTTP can access the FTP server it? FTP password has been set
Reply:
No problem. The URL to be accessed by pointing to the picture corresponding to the FTP server directory path, open access to the directory on it.
Reply:
ftp4j fine used
Reply:
references, 4th Floor yxinf reply:
no problem. The URL to be accessed by pointing to the picture corresponding to the FTP server directory path, open access to the directory on it.

can attach code to it
Reply:
references, 5th Floor luowenlong860502 reply:
ftp4j fine with

With FTPClient before the
Reply:
reference to the 6th floor u010749756 reply:
Quote: references to the 4th floor yxinf reply:

No problem. The URL to be accessed by pointing to the picture corresponding to the FTP server directory path, open access to the directory on it.

can attach code to it


This is a server-side configuration, no code. If the server is a windows operating system, to install IIS services; Linux operating system, then installing a configured apache httpd start to put on it.
Reply:
references, 5th Floor luowenlong860502 reply:
ftp4j fine with

How to configure the server cache get pictures?
Reply:
reference to the 8th floor yxinf reply:
Quote: references to the 6th floor u010749756 reply:

Quote: references to the 4th floor yxinf reply:

No problem. The URL to be accessed by pointing to the picture corresponding to the FTP server directory path, open access to the directory on it.

can attach code to it


This is a server-side configuration, no code. If the server is a windows operating system, to install IIS services; Linux operating system, then installing a configured apache httpd start to put on it.

You can give the idea of ​​what FTPClient
Reply:
FTP had a few operations: login, upload, download, directory listing, is already the most efficient.
Reply:
reference to the 11th floor tcmakebest reply:
FTP had a few operations: login, upload, download, directory listing, is already the most efficient.

How to get the server image cache configuration is downloaded directly to the phone?
Reply:
For FTP, only download

No comments:

Post a Comment