GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / GetAttachedThumbnail Method
GdPicture image identifier.
Example





In This Topic
GetAttachedThumbnail Method (GdPictureImaging)
In This Topic
Returns, if available, the tumbnail attached to a specific GdPicture image.
Syntax
'Declaration
 
Public Function GetAttachedThumbnail( _
   ByVal ImageID As Integer _
) As Integer
public int GetAttachedThumbnail( 
   int ImageID
)
public function GetAttachedThumbnail( 
    ImageID: Integer
): Integer; 
public function GetAttachedThumbnail( 
   ImageID : int
) : int;
public: int GetAttachedThumbnail( 
   int ImageID
) 
public:
int GetAttachedThumbnail( 
   int ImageID
) 

Parameters

ImageID
GdPicture image identifier.

Return Value

0: The image could not be created. Use the GetStat() method to determine the reason this method failed. Non-zero: GdPicture image identifier. The thumbnail Image. The ReleaseGdPictureImage() method must be subsequently used to release the image from the memory.
Remarks

This method requires the Image Documents component to run.

The HasAttachedThumbnail() should be used prior in order to check that the image has a thumbnail attachment.
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