Skip to content

Instantly share code, notes, and snippets.

@brucetoo
Created September 29, 2015 13:41
Show Gist options
  • Select an option

  • Save brucetoo/492926313ae822e4e503 to your computer and use it in GitHub Desktop.

Select an option

Save brucetoo/492926313ae822e4e503 to your computer and use it in GitHub Desktop.
Get a thumbnail image url from original url
/**
* get a thumbnail image url from original url
* @param imgUrl original image url
* @param width width u need
* @param height height u need
* @return the number(85) in below url indicate the quality of original image
*/
public static String getThumbnailImageUrl(String imgUrl,int width,int height){
String url="http://imgsize.ph.126.net/?imgurl=data1_data2xdata3x0x85.jpg&enlarge=true";
url=url.replaceAll("data1", imgUrl).replaceAll("data2", width+"").replaceAll("data3", height+"");
return url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment