GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / CreateGdPictureImageFromHTTP Method / CreateGdPictureImageFromHTTP(String,String,Int32) Method
The name of the host server, where the image file is located, for example www.gdpicture.com.
The file path of the image file on the host server, for example /demo/image.jpg.
The HTTP port number used. Usually 80 or 443 to use https transfer mode.
Example





In This Topic
CreateGdPictureImageFromHTTP(String,String,Int32) Method
In This Topic
Creates a new GdPicture image from an image file stored on a distant server using HTTP protocol according to what you have specified. The newly created image is identified by its unique non-zero image identifier.

Please note that it is your responsibility to release the image resources once you have no use for them.

Syntax
'Declaration
 
Public Overloads Function CreateGdPictureImageFromHTTP( _
   ByVal Host As String, _
   ByVal Path As String, _
   ByVal HTTPPort As Integer _
) As Integer
public int CreateGdPictureImageFromHTTP( 
   string Host,
   string Path,
   int HTTPPort
)
public function CreateGdPictureImageFromHTTP( 
    Host: String;
    Path: String;
    HTTPPort: Integer
): Integer; 
public function CreateGdPictureImageFromHTTP( 
   Host : String,
   Path : String,
   HTTPPort : int
) : int;
public: int CreateGdPictureImageFromHTTP( 
   string* Host,
   string* Path,
   int HTTPPort
) 
public:
int CreateGdPictureImageFromHTTP( 
   String^ Host,
   String^ Path,
   int HTTPPort
) 

Parameters

Host
The name of the host server, where the image file is located, for example www.gdpicture.com.
Path
The file path of the image file on the host server, for example /demo/image.jpg.
HTTPPort
The HTTP port number used. Usually 80 or 443 to use https transfer mode.

Return Value

A unique image identifier of the GdPicture image representing the newly created image. The returned value is non-zero if the image is successfully created. Please first of all use the GetStat method to determine if this method has been successful.

Use the GetLastTransferError method to diagnose the error if this method has failed with one of the GdPictureStatus.Internet... errors.

Be aware that you need to release the image with the ReleaseGdPictureImage method after being used.

Remarks
It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

All document formats currently supported by the toolkit are listed here.

This class loads multipage images (GIF and TIFF formats) in read-write mode by default. If you want to open multipage images in read-only mode, you need to call the GifOpenMultiFrameForWrite method for GIF format and the TiffOpenMultiPageForWrite method for TIFF format and set the WriteAccess parameter to false before creating an image.

This method requires the Image Documents component to run.

Example
Creating a GdPicture image from an image file stored on a distant server using HTTP protocol and saving to a PNG file.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromHTTP("https://upload.wikimedia.org", "wikipedia/commons/2/21/Hello_World_Brian_Kernighan_1978.jpg", 443);
    gdpictureImaging.SaveAsPNG(imageID, "image.png");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also