GdPicture.NET Reference Guide
AttachThumbnail Method (GdPictureImaging)
Example 





GdPicture14 Namespace > GdPictureImaging Class : AttachThumbnail Method
GdPicture Image Identifier.
GdPicture Image Identifier. The thumbnail bitmap.
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.
Example
Dealing with attached thumbnails.
Dim oGdPictureImaging As New GdPictureImaging
Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("myphoto.jpg")
'Detach existing thumbnail, if any.
oGdPictureImaging.DetachThumbnail(ImageID)
'Generates a HQ thumbnail.
Dim ThumbnailImageID As Integer = oGdPictureImaging.CreateThumbnailHQ(ImageID, CInt(oGdPictureImaging.GetWidth(ImageID) / 10), CInt(oGdPictureImaging.GetHeight(ImageID) / 10))
'Attach the generated thumbnail to the bitmap.
oGdPictureImaging.AttachThumbnail(ImageID, ThumbnailImageID)
'Releasing GdPicture thumbnail bitmap.
oGdPictureImaging.ReleaseGdPictureImage(ThumbnailImageID)
'Saving image to jpeg format.
oGdPictureImaging.SaveAsJPEG(ImageID, "imagewiththumbnail.jpg")
'Releasing input image.
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
'Now extracting the thumbnail from the created bitmap.
ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("imagewiththumbnail.jpg")
ThumbnailImageID = oGdPictureImaging.GetAttachedThumbnail(ImageID)
'Saving thumbnail as PNG
oGdPictureImaging.SaveAsPNG(ThumbnailImageID, "thumbnail.png")
'Releasing images from the memory
oGdPictureImaging.ReleaseGdPictureImage(ImageID)
oGdPictureImaging.ReleaseGdPictureImage(ThumbnailImageID)
'We're done with the oGdPictureImaging object.
oGdPictureImaging.Dispose()
See Also

Reference

GdPictureImaging Class
GdPictureImaging Members
HasAttachedThumbnail Method