Dave Burke : Freelance .NET Web Developer specializing in Online Communities

CS Photo Galleries Writer Plugin: Passing Pictures

The GalleryPost structure passed from the Community Server GalleryService Web Service looks like this.  We don't want to confuse this GalleryPost struct with CS.Galleries.Components.GalleryPost, of course.  Similar, but not the same.

public struct GalleryPost
{
public int PostID;
public string Subject;
public string Description;
public string Filename;
public string ContentType;
public long FileSize;
public byte[] PictureData;
public string[] Categories;
}

The image is contained in the PictureData byte[] array.  We'll retrieve that GalleryPost[] from a GetAlbumThumbnails() Web Method, a new method I added to the Gallery Service class since the  GalleryService.asmx served up the original image only.  Good news about those added DBVT methods; they are all separated out in a drop-in DLL with the client calling DBVTGalleryService.asmx, another deployment drop-in.  It will no longer be required to modify and recompile the CS.Galleries library to use this Plugin. 

Here the Image is read from a MemoryStream and added to the ImageList control.

private void cbAlbums_SelectedIndexChanged(object sender, EventArgs e)
{
CSMultiImageWindows.dbvtcs21.GalleryPost[] gp =
      wsGalleryService().GetAlbumThumbnails(int.Parse(cbAlbums.SelectedValue.ToString()));


listView1.Items.Clear();
imageListing.Images.Clear();

if (gp.Length > 1)

for (int i = 0; i < gp.Length; i++)
{

Stream stream = new MemoryStream(gp[ i ].PictureData, 0, (int)gp[ i ].FileSize);
Image img = Image.FromStream(stream, true);

imageListing.Images.Add(img);
ListViewItem item = new ListViewItem();
item.Tag = gp[ i ].PostID;
item.Text = gp[ i ].Filename;
item.ImageIndex = i;
listView1.Items.Add(item);
}

}

}

Comments (0) | Post RSS RSS comment feed

Posted on 9/6/2006 7:44:00 PM by Dave Burke
Categories: Community Server
Tags:

Related posts


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke