This project is read-only.

Downloading document information (e.g. thumbnail)

Sep 10, 2008 at 1:05 AM
I want to have access to the thumbnail associated with any public document.  However, I have found that I can only access the thumbnail of *my* documents using this method:

Bitmap bmp=null;
Scribd.Net.Document sdoc = new Scribd.Net.Document(id);
 if (sdoc != null)
{
if (sdoc.ThumbnailImage != null)
{
       bmp = sdoc.ThumbnailImage;
}
else if (sdoc.ThumbnailUrl != null)
{
       WebClient webClient = new WebClient();
       Stream stream = webClient.OpenRead(sdoc.ThumbnailUrl);
        if (stream != null)
       {
               System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
               bmp = new Bitmap(img);
               stream.Close();
               webClient.Dispose();
       }
}

2 questions:
- How do I access a public document's thumbnail and
- Is there a better image than the Thumbnail image provided in the Document object?  That one is VERY low-res; I want a higher res version.

Thanks.
Coordinator
Sep 11, 2008 at 9:20 PM
The first issue may be a limitation of the Scribd.API, but I'll check it out for sure.  The second is the image coming directly from Scribd.com, so I've no control over the resolution - it is what it is from those guys!
Coordinator
Sep 11, 2008 at 10:07 PM
The latest version (as of today) gives you the ability to set the thumbnail size.  I can't guarantee that the resolution will be any better because, again, this data is coming from Scribd.
Oct 2, 2008 at 4:04 PM
Can you please explain ho to set the thumbnail size and get thumbnail data for the specified size?
Coordinator
Oct 2, 2008 at 4:17 PM
You can set it in the constructor of the document.

Scribd.Net.Document _doc = new Scribd.Net.Document(theDocId, new Size(100, 120));

- Paul
Oct 2, 2008 at 4:24 PM
I tried that, but the bitmap still comes in a different size

Size

s = new Size(377,381);

 

Scribd.Net.

Document sDoc = new Scribd.Net.Document(ScribdDocumentId, s);

 

 

Bitmap b = sDoc.ThumbnailImage;

 

doc.FV_ThumbnailData = sDoc.ThumbnailImageData;

but I still get the size as 77 * 100.

Coordinator
Oct 2, 2008 at 4:35 PM
Well, that's because my code has a bug!  Doh!!

/// <summary>
        /// ctor
        /// </summary>
        /// <param name="documentId"></param>
        /// <param name="thumbnailSize"></param>
        public Document(int documentId, Size thumbnailSize)
            : this()
        {
            Document _temp = Document.Download(documentId);
            this.AccessKey = _temp.AccessKey;
            this.AccessType = _temp.AccessType;
            this.ConversionStatus = _temp.ConversionStatus;
            this.Description = _temp.Description;
            this.DocumentId = _temp.DocumentId;
            this.DocumentType = _temp.DocumentType;
            this.License = _temp.License;
            this.RevisionId = _temp.RevisionId;
            this.SecretPassword = _temp.SecretPassword;
            this.ShowAds = _temp.ShowAds;
            this.ThumbnailUrl = _temp.ThumbnailUrl;
            this.Title = _temp.Title;
            this.TagList.AddRange(_temp.TagList.ToArray());
        }

I'm not setting the given Thumbnail size in the constructor... 

I never said I was bright.  I'll have to fix this later today.

- Paul
Oct 2, 2008 at 4:39 PM
Paul,
So once you fix the code, will I be able to get the byte[] corresponding to the size I request? I am curious to see the resolution. I want to be able to view the thumbnail of the first page of the document I upload to scribd in 377 * 381. Thanks for taking time to look in ot this.
Coordinator
Oct 2, 2008 at 6:24 PM
Yes - that's the idea.  Keep in mind, however, that the thumbnail size is dictated by what Scribd provides.  Setting the thumbnail size on the constructor (once it's fixed) will resize it from 71x100 to whatever you indicate.   That WILL futz up the resolution, especially if you're going to make it larger.

I have no way of providing my/your desired thumbnail size to Scribd's API.  It's always the same and, again, any changes via this client library are purely post-receipt.

- P
Oct 2, 2008 at 7:59 PM
Paul,
I have got the larger image with better resolution to work. Basically the thumbnailurl for a doc returned by scribd is like 
http://i.scribd.com/profiles/images/5l7z9c9aup0w7-thumb.jpg with '5l7z9c9aup0w7'. being a unique ID
When I changed the 'thumb' to 'large' i got a larger image. So i am using the larger image and resizing that for my purpose. Hope this will help some one.
Coordinator
Oct 9, 2008 at 9:39 PM
That's a nice work-around.

I've modified the source code to fix the thumbnail sizing issue and added a Document.LargeImageUrl and Document.LargeImageData to allow you to get the large image through the client library.

- Paul