Draws a graphic held as raw data onto the canvas.

 

   
Syntax
 
     

[VBScript]
outRect = Canvas.DrawData(inData, inType, inParams)

 

   
Params
 
     
Name   Type   Description
inData Array The data to be drawn.
inType String See the Type Image Manipulation parameter for ways of specifying types.
inParams String A parameter string containing Override parameters, Positioning parameters, Transform parameters and Image Manipulation parameters.
outRect See Desc.

The Rect (before transformation) of the area drawn to.

Under ASP the return value is a comma delimited string.

 

   
Notes
 
     

This works in exactly the same way as the DrawFile method but allows you to draw an image that is only available as raw data (as an array of bytes).

You typically use a sample filename to specify the file type. However in most cases the type can be worked out even if an empty string is passed in.

If both the width and height of the Canvas have been specified the positioning of the image on the canvas will be determined by the Positioning and Transform parameters.

If the size of the canvas has not been completely determined the canvas will be Autosized.

 

   
See Also
 
     

Canvas DrawFile function.

 

   
Example
 
     

[VBScript]
Set xf = Server.CreateObject("ABCUpload4.XForm")

Set ca = Server.CreateObject("ImageGlue7.Canvas")
Set fl = xf("filefield")(1)
params = "Fit=True VAlign=middle HAlign=middle"

ca.Width = 300 ' constrain width
ca.DrawData fl.Data, fl.FileName, params
ca.SaveAs Server.MapPath("upload.jpg"), ""

The above takes a graphic file uploaded using an html upload. It constrains the width of the graphic and draws the data onto a canvas. Finally it saves the image out as a jpeg into the virtual directory of the web server.The following is an example of the html needed for the submitting form.

[VBScript]
<form method="post" action="upload.asp" name="submit" enctype="multipart/form-data">
  Choose a file to upload:<br>
  <input type="file" name="filefield" size="40"><br>
  <input type="submit" name="submit" value="submit"><br>
</form>