|
|
Create Image Using ASP - ASP
|
Views : 721
|
|
Tagged in : ASP
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Hi...
Create image using ASP use the below code.
<%
Function GetTempFileName(Byref FS)
GetTempFileName = FS.GetSpecialFolder(2) &".gif"
End Function
Sub CreateGifFromText(inText, FileName)
Dim chs: Set Chs = getOWC
Dim Chart: Set Chart = chs.Charts.Add //Get Chart Object
Chart.HasTitle = True //Enable Chart Title
Chart.Title.Caption = inText //Set the text
Chart.Title.Font.Color = "#660000"
Chart.Title.Font.italic = true
Chart.Title.font.bold = true
chs.Interior.Color="#d3d3d3" //Chart background
chs.ExportPicture FileName,, 60, 40 // Save the image as file
End Sub
Function getOWC
Dim chs : Set Chs = CreateObject("OWC10.ChartSpace") //create an OWC chart object. OWC(Office Web Components) is an library
if isempty(Chs) then Set Chs = CreateObject("OWC11.ChartSpace")
Set getOWC = Chs
End Function
Function ReadBinaryFile(FileName)
Const adTypeBinary = 1
Dim BinaryStream
Set BinaryStream = CreateObject("ADODB.Stream")
BinaryStream.Type = adTypeBinary
BinaryStream.Open
BinaryStream.LoadFromFile FileName
ReadBinaryFile = BinaryStream.Read
End Function
Function textToGIF(inText)
Dim FS: Set FS = CreateObject("Scripting.FileSystemObject")
Dim FileName: FileName = GetTempFileName(FS)
CreateGifFromText inText, FileName //sub procedure
textToGIF = ReadBinaryFile(FileName)
FS.DeleteFile FileName
End Function
Response.ContentType = "image/gif"
Response.binarywrite textToGIF(2134)
%>
|
|
By Nirmala, On - 2009-08-11 |
|
|
|