public static boolean placeImageUrl(Link link){
  String url=link.getUrl();
  if (!url.startsWith("http")) {
    url+="http://";
  }
  String domain=link.getDomain();
  if (domain.contains("imgur")) {
    if (url.contains(",")) {
      return false;
    }
 else     if (endsWithImageExtension(url,GIFV)) {
      return false;
    }
 else     if (url.contains(".com/gallery")) {
      return false;
    }
 else     if (url.contains(".com/a/")) {
      return false;
    }
 else     if (!checkIsImageUrl(url)) {
      if (url.charAt(url.length() - 1) == '/') {
        url=url.substring(0,url.length() - 2);
      }
      url+=".jpg";
    }
  }
  boolean isImage=checkIsImageUrl(url);
  if (!isImage) {
    return false;
  }
  link.setUrl(url);
  return true;
}

public static boolean placeImageUrl ( Link link ) { String url = link . getUrl ( ) ; if ( ! url . startsWith ( "http" ) ) { url += "http://" ; } String domain = link . getDomain ( ) ; if ( domain . contains ( "imgur" ) ) { if ( url . contains ( "," ) ) { return false ; } else if ( endsWithImageExtension ( url , GIFV ) ) { return false ; } else if ( url . contains ( ".com/gallery" ) ) { return false ; } else if ( url . contains ( ".com/a/" ) ) { return false ; } else if ( ! checkIsImageUrl ( url ) ) { if ( url . charAt ( url . length ( ) - 1 ) == '/' ) { url = url . substring ( 0 , url . length ( ) - 2 ) ; } url += ".jpg" ; } } boolean isImage = checkIsImageUrl ( url ) ; if ( ! isImage ) { return false ; } link . setUrl ( url ) ; return true ; }
sets link ' s url to proper image format if applicable
