GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / AttachThumbnail Method
GdPicture image identifier.
GdPicture image identifier. The thumbnail bitmap.
Example





In This Topic
AttachThumbnail Method (GdPictureImaging)
In This Topic
Attaches a thumbnail bitmap to a GdPicture image. If the GdPicture image already embeds a thumbnail it will be replaced.
Syntax
'Declaration
 
Public Function AttachThumbnail( _
   ByVal ImageID As Integer, _
   ByVal ThumbnailImageID As Integer _
) As GdPictureStatus
public GdPictureStatus AttachThumbnail( 
   int ImageID,
   int ThumbnailImageID
)
public function AttachThumbnail( 
    ImageID: Integer;
    ThumbnailImageID: Integer
): GdPictureStatus; 
public function AttachThumbnail( 
   ImageID : int,
   ThumbnailImageID : int
) : GdPictureStatus;
public: GdPictureStatus AttachThumbnail( 
   int ImageID,
   int ThumbnailImageID
) 
public:
GdPictureStatus AttachThumbnail( 
   int ImageID,
   int ThumbnailImageID
) 

Parameters

ImageID
GdPicture image identifier.
ThumbnailImageID
GdPicture image identifier. The thumbnail bitmap.

Return Value

A member of the GdPictureStatus enumeration.
Remarks

This method requires the Image Documents component to run.

Example
Removing the existing thumbnail and creating and attaching a new one to a GdPicture image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg");
 
    int thumbnailID = 0;
    if (gdpictureImaging.HasAttachedThumbnail(imageID))
    {
        // Get the already attached thumbnail and save it as an image, then detach it.
        thumbnailID = gdpictureImaging.GetAttachedThumbnail(imageID);
        gdpictureImaging.SaveAsJPEG(thumbnailID, "thumbnail.jpg", 75);
        gdpictureImaging.DetachThumbnail(imageID);
        gdpictureImaging.ReleaseGdPictureImage(thumbnailID);
    }
 
    // Create a new thumbnail with a system-defined size and attach it to an image.
    thumbnailID = gdpictureImaging.CreateThumbnail(imageID, 0, 0);
    gdpictureImaging.AttachThumbnail(imageID, thumbnailID);
 
    // Release used resources.
    gdpictureImaging.ReleaseGdPictureImage(thumbnailID);
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also