Reference Guide
GdPicture14 Namespace / GdPictureImaging Class / HasAttachedThumbnail Method
GdPicture image identifier.
Example





In This Topic
    HasAttachedThumbnail Method (GdPictureImaging)
    In This Topic
    Some images embed a thumbnail bitmap for previewing purpose. This method helps to determine if a specific GdPicture image has one.
    Syntax
    'Declaration
     
    
    Public Function HasAttachedThumbnail( _
       ByVal ImageID As Integer _
    ) As Boolean
    public bool HasAttachedThumbnail( 
       int ImageID
    )
    public function HasAttachedThumbnail( 
        ImageID: Integer
    ): Boolean; 
    public function HasAttachedThumbnail( 
       ImageID : int
    ) : boolean;
    public: bool HasAttachedThumbnail( 
       int ImageID
    ) 
    public:
    bool HasAttachedThumbnail( 
       int ImageID
    ) 

    Parameters

    ImageID
    GdPicture image identifier.

    Return Value

    True if a thumbnail bitmap is attached to the image, False otherwise.
    Remarks
    Use the GetStat() method to check if this method has completed successfully.
    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