Reputation: 1658
Is it possible to use PicasaWeb to host photos for my website? My requirement to upload and access within my ASP.NET Website.
Upvotes: 0
Views: 842
Reputation: 1658
public string UploadImage(byte[] imageBytes_, string imageName_)
{
string url = string.Empty;
try
{
PicasaEntry newPhoto = null;
MemoryStream ms = new MemoryStream();
ms.Write(imageBytes_, 0, imageBytes_.Length);
if (_albumFeed != null)
{
PicasaEntry photoEntry = new PhotoEntry();
photoEntry.MediaSource = new Google.GData.Client.MediaFileSource(ms, imageName_, "image/jpeg");
newPhoto = this._service.Insert<PicasaEntry>(new Uri(this._albumFeed.Post), photoEntry);
}
url = newPhoto.FeedUri;
}
catch (Exception ex)
{
throw new DneException("Error while uploading photo", ex );
}
return url ;
}
I am uploading a zipped images and extracting using SharpZipLib library. I am getting each file in chunk of bytes and which I am converting into MemoryStream later to pass the MediaSource object. I am getting 400 Bad Request error each time. When I am passing FileStream, it works fine but doesn't work with MemoryStream
Upvotes: 1
Reputation: 17010
Yes, technically. You can use the Picasa Web Albums Data API to access the metadata about your images and then display them from Picasa. For an album, this is not a horrible idea, but I would not use this method for your site graphics.
Upvotes: 2