public Collection < Size > getSizes ( String photoId , boolean sign ) throws FlickrException { SizeList < Size > sizes = new SizeList < Size > ( ) ; Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_GET_SIZES ) ; parameters . put ( "photo_id" , photoId ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element sizesElement = response . getPayload ( ) ; sizes . setIsCanBlog ( "1" . equals ( sizesElement . getAttribute ( "canblog" ) ) ) ; sizes . setIsCanDownload ( "1" . equals ( sizesElement . getAttribute ( "candownload" ) ) ) ; sizes . setIsCanPrint ( "1" . equals ( sizesElement . getAttribute ( "canprint" ) ) ) ; NodeList sizeNodes = sizesElement . getElementsByTagName ( "size" ) ; for ( int i = 0 ; i < sizeNodes . getLength ( ) ; i ++ ) { Element sizeElement = ( Element ) sizeNodes . item ( i ) ; Size size = new Size ( ) ; size . setLabel ( sizeElement . getAttribute ( "label" ) ) ; size . setWidth ( sizeElement . getAttribute ( "width" ) ) ; size . setHeight ( sizeElement . getAttribute ( "height" ) ) ; size . setSource ( sizeElement . getAttribute ( "source" ) ) ; size . setUrl ( sizeElement . getAttribute ( "url" ) ) ; size . setMedia ( sizeElement . getAttribute ( "media" ) ) ; sizes . add ( size ) ; } return sizes ; }
Get the available sizes of a Photo .