Web Hosting For ASP.NET World Class ASP.NET Hosting For LESS
24/7 Web Hosting For ASP.NET Money back guarantee Web Hosting For ASP.NET
Member Login •
Help Center •
Phone Number
1-214-7744035
Free Toll Call
Skip Navigation Links
Knowledgebase Home Page
Search the Knowledge Base
Keywords:
Search: Page Size:

Server Objects
Q: Persits ASPImage information

Details

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 <IMG> tag out for the browser to pick up 27 Response.Write "<IMG src="" msg1.jpg?? images><BR>" 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 "<H2>Welcome to</H2>" 32 end if 33 34 35



WebhostforASP.Net Copyright © 2003-2004 | All Rights Reserved |

All trademarks are property of their legal owners.