public static URL getUrlForSize ( JinxConstants . PhotoSize size , String photoId , String secret , String farm , String server , String originalFormat , String originalSecret ) throws JinxException { JinxUtils . validateParams ( photoId , size , farm , server ) ; if ( size == JinxConstants . PhotoSize . SIZE_ORIGINAL ) { JinxUtils . validateParams ( originalFormat , originalSecret ) ; } else { JinxUtils . validateParams ( secret ) ; } StringBuilder sb = new StringBuilder ( "https://farm" ) ; sb . append ( farm ) ; sb . append ( ".static.flickr.com/" ) ; sb . append ( server ) . append ( "/" ) ; sb . append ( photoId ) . append ( ' ' ) ; switch ( size ) { case SIZE_SMALL_SQUARE : sb . append ( secret ) . append ( "_s.jpg" ) ; break ; case SIZE_LARGE_SQUARE : sb . append ( secret ) . append ( "_q.jpg" ) ; break ; case SIZE_THUMBNAIL : sb . append ( secret ) . append ( "_t.jpg" ) ; break ; case SIZE_SMALL : sb . append ( secret ) . append ( "_m.jpg" ) ; break ; case SIZE_SMALL_320 : sb . append ( secret ) . append ( "_n.jpg" ) ; break ; case SIZE_MEDIUM : sb . append ( secret ) . append ( ".jpg" ) ; break ; case SIZE_MEDIUM_640 : sb . append ( secret ) . append ( "_z.jpg" ) ; break ; case SIZE_MEDIUM_800 : sb . append ( secret ) . append ( "_c.jpg" ) ; break ; case SIZE_LARGE : sb . append ( secret ) . append ( "_b.jpg" ) ; break ; case SIZE_LARGE_1600 : sb . append ( secret ) . append ( "_h.jpg" ) ; break ; case SIZE_LARGE_2048 : sb . append ( secret ) . append ( "_k.jpg" ) ; break ; case SIZE_ORIGINAL : sb . append ( originalSecret ) . append ( "_o" ) ; sb . append ( ' ' ) . append ( originalFormat ) ; break ; default : throw new JinxException ( "Undefined size: " + size ) ; } try { return new URL ( sb . toString ( ) ) ; } catch ( Exception e ) { throw new JinxException ( "Could not create URL from string " + sb . toString ( ) ) ; } }
Get the URL for a specific size of photo .