ASP Image Usage Example

Source: Internet
Author: User
Tags html header

Using the Aspimage component requires only the following steps:

Build an Object
Set several properties
Calling the SaveImage method
The following code gives an example of how to use the Aspimage component in VBScript, in which we create a text picture that is progressively populated with the words "Welcome to":
Set Image = Server.CreateObject ("Aspimage.image")

rem Set various font parameters
Image.fontcolor = Vbblack
Image.italic = True
Image.bold = True
Image.fontname = "Arial"
Image.fontsize = 12
Image.padsize = 10

REM Calculate how big we text info is and set the "to" size
Remthis has to being done since we want to fill the area with a gradient
strmessage = "Welcome to"
Image.maxx = Image.textwidth (strmessage)
Image.maxy = Image.textheight (strmessage)

REM Create a one way gradient
Image.gradientoneway vbred, Vbwhite, 0

REM Print our string to the image
Image.textout strmessage, image.x, Image.y, False

REM Set the filename and save
Remnote:you should gen the filename dynamically for multiuser usage
Image.filename = "D:inetpubwwwrootimagesmsg1.jpg"
If Image.saveimage Then
REM The image is saved so write the tag out for the browser to pick up
Response.Write "<br>"
Else
Rem Something happened and we couldn ' t save the image so just use an HTML header
Remwe need to debug the script and find out what went wrong
Response.Write "End If



By using the SaveImage method, we can tell if the picture has been saved correctly. Generally, the reason why the picture is not saved correctly is that the picture's save path is not valid or does not have permission to write to the path.

GIF Animations
Pictures can be loaded or processed, and you can save them to an animation in an active order by calling the AddImage method. There is a simple GIF animation example in Soianim.asp, which is packaged into a aspimage zip file.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.