This project is read-only.

Image ID for uploaded image

Jul 24, 2008 at 4:47 AM

Sorry, I think I posted this to the wrong section.   Anyway, here is my  question.

I used the lines below to upload an image, and it did upload. My question is how will I get the image id returned after this upload?

Dim api As New SmugMugApiWrapper.SmugMugApi("email", "password")
Dim args As New PostPicturesToSmugMugArguments
args.AlbumName = "another1"
Dim fileList As New List(Of String)
fileList.Add(FileUpload1.PostedFile.FileName)
api.PostPicturesToSmugMug(fileList, args)

Thanks!
Sherwin

Jul 28, 2008 at 5:22 AM
Hi Sherwin,

I inadvertently forgot to set this up so that it would email me after a new item was entered.  I'll look into this and see what I can see.  I'm pretty sure you dont get the image id back yet, but I can almost certainly change things around so that you get one back.

The thing I have been doing is posting the images, and then doing GetImagesInfo to get the information back on the whole album:  I generally post one album at a time, although I see where getting the image back for each thing you post would be handy. 

(GetImagesInfo gets you information on each image in an album, GetImages gets you the actual jpgs too,)


Jul 28, 2008 at 9:34 AM
I have added PostPicturesToSmugMugWithReturnInfo, which looks like:

public SmugMugImagesInfo PostPicturesToSmugMugWithReturnInfo(List<string> fileList, PostPicturesToSmugMugArguments arguments)

so its pretty much the same as PostPicturesToSmugMug, but instead of being void, it gives you a SmugMugImagesInfo with ONLY the image id and image key in it.  I havent tested it, but you can grab the source and use it if you want, until I do a .9 release. 

You can look at the sample in Program.cs of the sendtosmgmug project in the source to see how it's used:

                   SmugMugApi Api = new SmugMugApi(userName, userPassword);
                    List<string> fileList = new List<string>();
                    PostPicturesToSmugMugArguments parameters = new PostPicturesToSmugMugArguments();

                    fileList.Add(fileToUpload);
                    parameters.AlbumName = albumToSendFilesTo;
                    if (!String.IsNullOrEmpty(pictureCaption)) parameters.Caption = pictureCaption;
                    if (!String.IsNullOrEmpty(pictureKeywords)) parameters.Keywords = pictureKeywords;

                    Console.WriteLine("Uploading {0} file" + (fileList.Count > 1 ? "s " : " ") + "to smugmug.  This may take a while.", fileList.Count);

                    SmugMugImagesInfo info = Api.PostPicturesToSmugMugWithReturnInfo(fileList, parameters);
                    Console.WriteLine( info[0].ImageID + " " + info[0].ImageKey);

Jul 28, 2008 at 4:56 PM
Thanks for the update.  I will test this your changes and will let you know if I bump into something.  I really appreciate your work in this API.  Thanks a lot!