Skip to content

Commit 3379aa0

Browse files
committed
Makes linked images bigger
1 parent 2336aa6 commit 3379aa0

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/main/java/edu/ncsu/dlf/utils/ImageUtils.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)