@@ -67,7 +67,10 @@ public static String uploadPhoto(BufferedImage image) throws IOException {
6767 throw new IOException ("Problem uploading photo" , e );
6868 }
6969
70- publicLinkToPhoto = returnedPhoto .getMediaContents ().get (0 ).getUrl ();
70+ publicLinkToPhoto = returnedPhoto .getMediaThumbnails ().get (0 ).getUrl ();
71+
72+ //scale it up to 800 px, which is the largest we can hotlink to
73+ publicLinkToPhoto = publicLinkToPhoto .replace ("/s72/" , "/s800/" ).replace ("/s144/" , "/s800/" ).replace ("/s288/" , "/s800/" );
7174 }
7275 return publicLinkToPhoto ;
7376 }
@@ -85,7 +88,7 @@ private static void main(String[] args) throws IOException, ServiceException {
8588
8689 URL feedUrl = new URL ("https://picasaweb.google.com/data/feed/api/user/default/albumid/" +pdfAlbumId );
8790
88- BufferedImage image = ImageIO .read (new File ("test.png " ));
91+ BufferedImage image = ImageIO .read (new File ("test.jpg " ));
8992
9093 ByteArrayOutputStream baos = new ByteArrayOutputStream ();
9194
@@ -96,12 +99,6 @@ private static void main(String[] args) throws IOException, ServiceException {
9699 PhotoEntry returnedPhoto = photoService .insert (feedUrl , PhotoEntry .class , myMedia );
97100
98101 System .out .println (returnedPhoto );
99- System .out .println (returnedPhoto .getId ());
100- System .out .println (returnedPhoto .getHtmlLink ());
101- System .out .println (returnedPhoto .getHtmlLink ().getHref ());
102- System .out .println (returnedPhoto .getMediaContents ());
103- System .out .println (returnedPhoto .getMediaContents ().get (0 ));
104- System .out .println (returnedPhoto .getMediaContents ().get (0 ).getUrl ()); //this one works
105102
106103 }
107104
0 commit comments