PicasawebService myService = new PicasawebService("example");
myService.setUserCredentials("<ここにユーザID>", "<ここにパスワード>");
URL albumPostUrl = new URL("http://picasaweb.google.com/data/feed/api/user/<ここにユーザID>/albumid/<ここにアルバムID>");
PhotoEntry myPhoto = new PhotoEntry();
myPhoto.setTitle(new PlainTextConstruct("ファイル名"));
myPhoto.setDescription(new PlainTextConstruct("タイトル"));
myPhoto.setClient("クライアント名");//ちょっとここは不明
MediaFileSource myMedia = new MediaFileSource(new File("C:\\temp\\kiku.jpg"), "image/jpeg");
myPhoto.setMediaSource(myMedia);
PhotoEntry returnedPhoto = myService.insert(albumPostUrl, myPhoto);
最後のreturnedPhoto には、アップしたファイルのURLなどが格納されています。2011-05-17
Picasaへ写真を投稿する
以前の、GooglePicasa APIを試してみたの続編で、JavaでPicasaに写真をアップロードするサンプルです。
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿