GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / SaveToFTP Method
GdPicture image identifier.
A member of the DocumentFormat enumeration. Currently supported formats are:

DocumentFormatBMP.

DocumentFormatJPEG.

DocumentFormatPNG.

DocumentFormatTIFF.

DocumentFormatGIF.

DocumentFormatJ2K (JPEG2000 codestream).

DocumentFormatJP2 (JPEG2000)

DocumentFormatTARGA.

DocumentFormatEXR.

DocumentFormatWBMP.

DocumentFormatXPM.

DocumentFormatPBM.

DocumentFormatWMF.

DocumentFormatWEBP.

Compression or encoding quality to use.

For JPEG format: the parameter defines the quality between 1 (lower) and 100 (higher).

For WebP format: the parameter defines the quality between 1 (lower) and 100 (higher - lossless encoding).

For TIFF format: the parameter defines the compression scheme to be used: 1 for none, 2 for RLE, 3 for CCITT3, 4 for CCITT4, 5 for LZW, 7 for JPEG, 32946 for Deflate and 65536 for automatic compression adjustment. For more options the SaveAsTiff() method taking a Stream object as parameter can be used.

For JPEG2000 format: the parameter defines the compression rate Between [1(MaxQuality - Lossless) ... 512(Poor quality)]. Default value is 16.

For PNG format: the parameter defines the compression level Between [0(no compression - faster encoding) ... 9(max compression - slower encoding)]. Default value is 6.

For other formats use 0.

The host server ie: ftp.com.
The image file path to create into the distant server ie: /demo/image.jpg.
User Login.
User Password.
The FTP port number used. Usually 21.
Example





In This Topic
SaveToFTP Method (GdPictureImaging)
In This Topic
Saves a GdPicture image into a FTP server.
Syntax
'Declaration
 
Public Function SaveToFTP( _
   ByVal ImageID As Integer, _
   ByVal ImageFormat As DocumentFormat, _
   ByVal EncoderParameter As Integer, _
   ByVal Host As String, _
   ByVal Path As String, _
   ByVal Login As String, _
   ByVal Password As String, _
   ByVal FTPPort As Integer _
) As GdPictureStatus
public GdPictureStatus SaveToFTP( 
   int ImageID,
   DocumentFormat ImageFormat,
   int EncoderParameter,
   string Host,
   string Path,
   string Login,
   string Password,
   int FTPPort
)
public function SaveToFTP( 
    ImageID: Integer;
    ImageFormat: DocumentFormat;
    EncoderParameter: Integer;
    Host: String;
    Path: String;
    Login: String;
    Password: String;
    FTPPort: Integer
): GdPictureStatus; 
public function SaveToFTP( 
   ImageID : int,
   ImageFormat : DocumentFormat,
   EncoderParameter : int,
   Host : String,
   Path : String,
   Login : String,
   Password : String,
   FTPPort : int
) : GdPictureStatus;
public: GdPictureStatus SaveToFTP( 
   int ImageID,
   DocumentFormat ImageFormat,
   int EncoderParameter,
   string* Host,
   string* Path,
   string* Login,
   string* Password,
   int FTPPort
) 
public:
GdPictureStatus SaveToFTP( 
   int ImageID,
   DocumentFormat ImageFormat,
   int EncoderParameter,
   String^ Host,
   String^ Path,
   String^ Login,
   String^ Password,
   int FTPPort
) 

Parameters

ImageID
GdPicture image identifier.
ImageFormat
A member of the DocumentFormat enumeration. Currently supported formats are:

DocumentFormatBMP.

DocumentFormatJPEG.

DocumentFormatPNG.

DocumentFormatTIFF.

DocumentFormatGIF.

DocumentFormatJ2K (JPEG2000 codestream).

DocumentFormatJP2 (JPEG2000)

DocumentFormatTARGA.

DocumentFormatEXR.

DocumentFormatWBMP.

DocumentFormatXPM.

DocumentFormatPBM.

DocumentFormatWMF.

DocumentFormatWEBP.

EncoderParameter
Compression or encoding quality to use.

For JPEG format: the parameter defines the quality between 1 (lower) and 100 (higher).

For WebP format: the parameter defines the quality between 1 (lower) and 100 (higher - lossless encoding).

For TIFF format: the parameter defines the compression scheme to be used: 1 for none, 2 for RLE, 3 for CCITT3, 4 for CCITT4, 5 for LZW, 7 for JPEG, 32946 for Deflate and 65536 for automatic compression adjustment. For more options the SaveAsTiff() method taking a Stream object as parameter can be used.

For JPEG2000 format: the parameter defines the compression rate Between [1(MaxQuality - Lossless) ... 512(Poor quality)]. Default value is 16.

For PNG format: the parameter defines the compression level Between [0(no compression - faster encoding) ... 9(max compression - slower encoding)]. Default value is 6.

For other formats use 0.

Host
The host server ie: ftp.com.
Path
The image file path to create into the distant server ie: /demo/image.jpg.
Login
User Login.
Password
User Password.
FTPPort
The FTP port number used. Usually 21.

Return Value

A member of the GdPictureStatus enumeration. If HTTP or FTP error status is returned the GetLastTransferError method can be used to diagnose the error.
Remarks

This method requires the Image Documents component to run.

Example
Saving an image to a file located on a distant server using FTP transfer.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.bmp");
    // Set the active FTP transfer more.
    gdpictureImaging.SetFtpPassiveMode(false);
    if (gdpictureImaging.SaveToFTP(imageID, GdPicture14.DocumentFormat.DocumentFormatJPEG, 75, "ftp.com", "/demo/image.jpg", "user", "password", 21) != GdPictureStatus.OK)
    {
        MessageBox.Show("Saving failed. Status: " + gdpictureImaging.GetStat() + "\nError: " + gdpictureImaging.GetLastTransferError(),
                        "Saving using FTP", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also