Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
LInetHttp::SendBitmap
#include "ltwrappr.h"
L_INT LInetHttp::SendBitmap(pBitmapBase, nFormat, nQFactor, pszContentType, pNameValue, pSaveFileOption = NULL)
L_INT LInetHttp::SendBitmap(pBitmap, nFormat, nBitsPerPixel, nQFactor, pszContentType, pNameValue, pSaveFileOption = NULL)
LBitmapBase *pBitmapBase; |
/* pointer to an LBitmapBase object */ |
pBITMAPHANDLE pBitmap; |
/* pointer to a bitmap handle */ |
L_INT nFormat; |
/* output file format */ |
L_INT nBitsPerPixel; |
/* output bits per pixel */ |
L_INT nQFactor; |
/* quality factor */ |
L_TCHAR *pszContentType; |
/* HTTP content type */ |
pNAMEVALUE pNameValue; |
/* pointer to a structure */ |
pSAVEFILEOPTION pSaveFileOption; |
/* pointer to extended save options */ |
Sends a bitmap to an HTTP server.
Parameter |
Description |
pBitmapBase |
Pointer to an LBitmapBase classes object referencing the bitmap to send. |
pBitmap |
Pointer to the bitmap handle referencing the bitmap to send. The bitmap handle can contain the actual data, but does not have to, since your callback function can supply the data. However, the bitmap handle must contain values for the following fields: Width, Height, BitsPerPixel, BytesPerLine, nColors, ViewPerspective, Order, and DitheringMethod. (The BytesPerLine value must be a multiple of four.) |
nFormat |
Output file format. For valid values, refer to Formats of Output Files. |
nBitsPerPixel |
Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files. If nBitsPerPixel is 0, the file will be stored using the closet BitsPerPixel value supported by that format. For example, if a file format supports 1, 4, and 24 BitsPerPixel, and the pBitmap->BitsPerPixel is 5, the file will be stored as 24 bit. Likewise, if the pBitmap->BitsPerPixel is 2, the file will be stored as 4 bit. |
nQFactor |
This parameter is used when saving an image file to FILE_CMP, FILE_JFIF, FILE_LEAD1JFIF, FILE_LEAD2JFIF, FILE_JTIF, FILE_LEAD1JTIF, FILE_LEAD2JTIF, FILE_FPX_JPEG_QFACTOR, and FILE_EXIF_JPEG. Qfactor is a number that determines the degree of loss in the compression process. For possible values, refer to Compression Quality Factors. |
pszContentType |
A string describing the content type. This string is usually formatted type/subtype where type is the general content category and subtype is the specific content type. For a full list of supported content types, see your Web browser documentation or the current HTTP specification. |
pNameValue |
A pointer to the structure that contains the name/value pair for this image. This information is used to get the information from a script on the server machine. This name is usually some user-defined name and the value is the filename of the image. |
pSaveOptions |
Pointer to optional extended save options. Pass NULL to use the default save options. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
It is up to a script on the server side to process the data when it is received. This script is specified in the LInetHttp::OpenRequest function. The script can be any type of file that is recognized by the HTTP Server.
This function actually saves a LEADTOOLS bitmap to a file in memory, and then sends the resulting memory file to an HTTP server.
Note: The LEADTOOLS Uploading Component can be used in an ASP page to extract the uploaded data.
Required DLLs and Libraries
LTWEB For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application |
See Also
Functions: |
LInetHttp::OpenRequest, LInetHttp::SendData, LInetHttp::SendForm, LInetHttp::SendRequest, Class Members |
Topics: |
|
|
Example
/* The following sample is for LInetHttp::SendBitmap(pBitmapBase, nFormat, nQFactor, pszContentType, pNameValue, pSaveFileOption = NULL)*/ // This sample sends a bitmap to the HTTP web server L_INT LInetHttp_SendBitmapExample_1(LBitmapBase Bitmap, HWND hWndParent) { L_INT nRet; NAMEVALUE nv; LInetHttp InetHttp(TEXT("www.leadtools.com")); // Checking if the connection failed nRet = InetHttp.GetErrorFromList (); if(nRet != SUCCESS) { InetHttp.DisplayError (hWndParent, TEXT("Can't connect to the HTTP web server")); return nRet; } nRet = InetHttp.OpenRequest (HTTP_POST, TEXT("/upload.asp")); if(nRet != SUCCESS) { InetHttp.DisplayError(hWndParent, TEXT("Can't open a request")); return nRet; } nv.pszName = TEXT("Photo"); nv.pszValue = TEXT("photo1.jpg"); nRet = InetHttp.SendBitmap (&Bitmap, FILE_JPEG, 200, TEXT("image/jpg"), &nv); if(nRet != SUCCESS) { InetHttp.DisplayError (hWndParent, TEXT("Can't send an image, an error may occurred")); return nRet; } return SUCCESS; } //--------------------------------------------------------------------------------------------------------------- /*The following sample is for LInetHttp::SendBitmap(pBitmap, nFormat, nBitsPerPixel, nQFactor, pszContentType, pNameValue, pSaveFileOption = NULL)*/ // This sample also sends a bitmap to the HTTP web server L_INT LInetHttp_SendBitmapExample_2(pBITMAPHANDLE pBitmap, HWND hWndParent) { L_INT nRet; NAMEVALUE nv; LInetHttp InetHttp(TEXT("www.leadtools.com")); // Checking if the connection failed nRet = InetHttp.GetErrorFromList (); if(nRet != SUCCESS) { InetHttp.DisplayError (hWndParent, TEXT("Can't connect to the HTTP web server")); return nRet; } nRet = InetHttp.OpenRequest (HTTP_POST, TEXT("/upload.asp")); if(nRet != SUCCESS) { InetHttp.DisplayError(hWndParent, TEXT("Can't open a request")); return nRet; } nv.pszName = TEXT("Photo"); nv.pszValue = TEXT("photo1.jpg"); nRet = InetHttp.SendBitmap(pBitmap, FILE_JPEG, 24, 200, TEXT("image/jpg"), &nv); if(nRet != SUCCESS) { InetHttp.DisplayError (hWndParent, TEXT("Can't send an image, an error may occurred")); return nRet; } return SUCCESS; } /************************************************************************* The following upload.asp page can be used to get access to the upload file. Upload.asp also makes use of the LEAD Upload control. <% Set Upload = Server.CreateObject("LEAD.Upload") Lead.EnableMethodErrors = false set files = Upload.Upload Upload.Save "c:\inetpub\wwwroot\" ' Process all files received For Each File in Files Response.Write File.Name & " = " & File.FileName & "<BR>" Response.Write "Size = " & File.Size & "<BR>" Response.Write "<BR><BR>" Next %> *************************************************************************/