Persits ASPImage information

Using the component is as simple as

  1. Creating the object
  2. Setting a few properties
  3. Calling the SaveImage method

The following code demonstrates how to use ASPImage from VBScript. In this example we'll create a text image that say's "Welcome to" with a gradient fill.

 

                                                        
1 P>Set Image = Server.CreateObject("AspImage.Image")
2
3 rem Set various font parameters
4 Image.FontColor = vbBlack
5 Image.Italic = True
6 Image.Bold = True
7 Image.FontName = "Arial"
8 Image.FontSize = 12
9 Image.PadSize = 10
10
11 rem Calculate how big our text info is and set the image to this size
12 rem This has to be done since we want to fill the area with a gradient
13 strMessage = "Welcome to"
14 Image.MaxX = Image.TextWidth (strMessage)
15 Image.MaxY = Image.TextHeight (strMessage)
16
17 rem Create a one way gradient
18 Image.GradientOneWay vbRed, vbWhite, 0
19
20 rem Print our string to the image
21 Image.TextOut strMessage, Image.X, Image.Y, false
22
23 rem Set the filename and save
24 Image.FileName = "d:\inetpub\wwwroot\images\msg1.jpg"
25 if Image.SaveImage then
26 rem The image was saved so write the tag out for the browser to pick up
27 Response.Write "
"
28 else
29 rem Something happened and we couldn't save the image so just use an HTML header
30 rem We need to debug the script and find out what went wrong. See Image.Error for details
31 Response.Write "

Welcome to

"
32 end if
33
34
35
  • 10 کاربر این را مفید یافتند
آیا این پاسخ به شما کمک کرد؟

مقالات مربوطه

Graphics Server .NET Information

Graphics Server .NET is an ASP.NET charting component that can be used to generate charts from...

Persits ASPJpeg Sample Code

Sample code to resize an image with ASPJpeg 1.6. User will need to customize...

Persits ASPJpeg Information

AspJpeg is a high-quality image thumbnail component that can resize images on-the-fly. Some...

Persits ASPUpload Information

ASPUpload enables an ASP application to capture, save and process files uploaded to the web...

WebSupergoo ABCpdf.NET Information

WebSupergoo ABCpdf.NET is an ASP.NET component that creates PDF files on the fly. WebSupergoo...