Thanks for sharing this Steve, that's great.
Nicolas
On Nov 26, 11:28 pm, steve <[EMAIL PROTECTED]> wrote:
> Disregard my comment about the ‘for loop’ exiting problem. I just
> realized I had previously fixed that problem :-).
>
> On Nov 26, 6:22 pm, steve <[EMAIL PROTECTED]> wrote:
>
> > I’ve discovered that Google Base sometimes indicates there are images,
> > however when I try to display the image it doesn’t exist. I don’t
> > know if it’s a problem with Base, or if the publisher deleted the
> > photo. I’ve worked around the problem by first checking if the image
> > exists. See the code below.
>
> > The C# code below transfers the images from GBaseEntry to my "Vehcile"
> > object. The 'for loop' could use some optimization, and exit when the
> > web request fails.
>
> > if (entry.GBaseAttributes.GetUrlAttributes("image link").GetLength
> > (0) > 0)
> > {
> > foreach (string imageLink in
> > entry.GBaseAttributes.GetUrlAttributes("image link"))
> > {
> > vehicle.SmallImageLink.Add(imageLink);
> > vehicle.ImageCount++;
>
> > if (vehicle.primarySmallImage == "~/Images/NoPhoto.gif")
> > vehicle.primarySmallImage = imageLink;
>
> > //get the primary small image link
> > if (imageLink.Length < vehicle.primarySmallImage.Length)
> > {
> > vehicle.primarySmallImage = imageLink;
> > }
> > }
>
> > try
> > {
> > // Creates an HttpWebRequest for the specified URL.
> > HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create
> > (vehicle.primarySmallImage);
> > // Sends the HttpWebRequest and waits for a response.
> > HttpWebResponse myHttpWebResponse = (HttpWebResponse)
> > myReq.GetResponse();
> > if (myHttpWebResponse.StatusCode != HttpStatusCode.OK)
> > {
> > vehicle.ImageCount = 0;
> > vehicle.primarySmallImage = "~/Images/NoPhoto.gif";
> > }
> > }
> > catch (Exception)
> > {
> > vehicle.ImageCount = 0;
> > vehicle.primarySmallImage = "~/Images/NoPhoto.gif";
> > }
> > }
>
> >www.fecfs.com
>
> > On Nov 26, 4:39 pm, "Nicolas (Google)" <[EMAIL PROTECTED]> wrote:
>
> > > Hi Dennis,
>
> > > Unfortunately there is currently a bug on the "image_link" attribute.
> > > The issues have already been reported and we are waiting for a fix
> > > from our engineering team.
>
> > > For your information, I think the correct Query URI would
> > > be:http://www.google.com/base/feeds/snippets/-/vehicles?bq=[year:2006][price%3C15000%20usd][vehicle_type:Sedan][image%20link]
>
> > > But as you can imagine I can't test this right now :)
>
> > > In the mean time, as a workaround I would recommend downloading the
> > > query result without filtering on the image_link attribute :
>
> > >http://www.google.com/base/feeds/snippets/-/vehicles?bq=[year:2006][price%3C15000%20usd][vehicle_type:Sedan]
> > > and then filtering the search result programmatically.
>
> > > Cheers,
> > > Nicolas
>
> > > On Nov 26, 5:46 pm, Dennis123 <[EMAIL PROTECTED]> wrote:
>
> > > > I would like to do a query that only shows cars with a photo, without
> > > > having to manually sort thru them
>
> > > > So I pretty much want to do something like
> > > > this..http://www.google.com/base/feeds/snippets/-/vehicles?bq=[year:2006][price%3C15000%20usd][vehicle_type:Sedan][image_link!=null]
>
> > > > Any ideas?
>
> > > > Thanks much!
> > > > Dennis- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Base Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---