4 messages in com.googlegroups.google-picasa-data-api[PWA API] Re: Forcibly closed connect...| From | Sent On | Attachments |
|---|---|---|
| SteveW | 04 Jul 2008 05:52 | |
| Jeff Fisher (Google) | 07 Jul 2008 15:21 | |
| SteveW | 10 Jul 2008 01:59 | |
| Frank Mantek | 10 Jul 2008 08:21 |
| Subject: | [PWA API] Re: Forcibly closed connection streaming thumbnails in C#![]() |
|---|---|
| From: | SteveW (stev...@googlemail.com) |
| Date: | 07/10/2008 01:59:26 AM |
| List: | com.googlegroups.google-picasa-data-api |
Hi,
Sorry, that should just be "feed", not "feed2".
So my code is doing pretty much the same as the example you gave.
I'm still getting the same error. I also get the error with the PhotoBrowser example code which leads me to think it's not a problem in my code, but perhaps something else at my side? I'm developing on a company machine so could it be a firewall or some other security?
Thanks. Steve
On Jul 7, 11:22 pm, "Jeff Fisher (Google)" <api....@google.com> wrote:
Hi,
Your code doesn't quite make sense, since I'm not sure what "feed2" is. I was able to load 10 thumbnails (or more!) into Bitmap objects without getting that error:
string feedUrl = "http://picasaweb.google.com/data/feed/api/user/ test.jfisher/album/Testalbum1";
PhotoQuery query = new PhotoQuery(feedUrl); query.Thumbsize = "32c"; query.NumberToRetrieve = 10;
PicasaFeed feed = service.Query(query);
foreach (PicasaEntry entry in feed.Entries) { Console.WriteLine(entry.Title.Text); Console.WriteLine(entry.Media.Thumbnails[0].Url); Stream stream = service.Query(new Uri(entry.Media.Thumbnails[0].Url));
Bitmap test = new Bitmap(stream); //save bitmap reference here
}
Cheers, -Jeff
On Jul 4, 5:53 am, SteveW <stev...@googlemail.com> wrote:
Hi,
I'm trying to develop an application for browsing Picasa albums using c# in windows compact framework, I've been working from the PhotoBrowser example code, but have hit a problem.
The code retrieves 10 photos from the user and I'm saving them in an ImageList to display in a listview object, as below. It works fine for anything up to NumberToRetrieve is 2, but after that the query to stream the image from the thumbnail URL generates an exception error code 10054:
"An existing connection was forcibly closed by the remote host"
I have the same problem when I run the PhotoBrowser application, the first thumbnail or two are downloaded fine, but then an exception is received until you send a PhotoQuery to a new album.
I can solve the problem by adding a new PhotoQuery
PicasaFeed feed = myService.Query(p_query);
in the for loop, so a new query is generated every iteration of the loop before streaming a thumbnail, but this seems a bit inefficient given I already have the URLs in the feed before streaming the thumbnails.
Can anyone tell me why my connection is being closed? And is this the only way to solve the problem?
Thanks in advance, Steve
PhotoQuery p_query = new PhotoQuery(PicasaQuery.CreatePicasaUri(user)); p_query.Thumbsize = ("32c"); // set thumbnail size p_query.NumberToRetrieve = 10; // retrieve 10 images
PicasaFeed feed = myService.Query(p_query);
if (feed2 != null && feed2.Entries.Count > 0) { int imageCount = feed2.Entries.Count;
for (int i = 0; i < imageCount; i++) { PicasaEntry entry = feed2.Entries[i] as PicasaEntry;
// find smallest thumbnail for image
MediaThumbnail smallest = GetSmallestThumbnail(entry.Media.Thumbnails);
Stream stream = myService.Query(new Uri(smallest.Attributes["url"] as string));
myImageList.Add( new Bitmap(stream) );
}
}- Hide quoted text -
- Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" group.
To post to this group, send email to Goog...@googlegroups.com
To unsubscribe from this group, send email to
Goog...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Google-Picasa-Data-API?hl=en
-~----------~----~----~----~------~----~------~--~---




