[VBScript]
Set ca = Server.CreateObject("ImageGlue7.Canvas")
txt = "In a hole in the ground there lived a hobbit. Not a nasty,
dirty, wet hole, filled with the ends of worms and an oozy smell,
nor yet a dry, bare, sandy hole with..."
pars = "Rect=10,10,190,190"
ca.Color = "yellow"
ca.Width = 200
ca.Height = 200
ca.TextFont = "Times"
ca.TextSize = 18
ca.TextLength txt, pars, mylen
ca.DrawText txt, pars
ca.SaveAs Server.MapPath("textlen.jpg"), "Quality=high"
Response.Write("Only able to fit " & mylen & " characters
onto the canvas<br>")
Response.Write("<b>Original Text</b><br> " &
txt & "<br>")
Response.Write("<b>Drawn Text</b><br> " &
Left(txt, mylen) & "<br>")
The code draws out a piece of text onto a rather small canvas.
It also works out how much text was drawn onto the canvas and
writes it out as HTML. The image saved and the page output is shown
below.
textlen.jpg
Only able to fit 106 characters onto the canvas
Original Text
In a hole in the ground there lived a hobbit. Not a nasty, dirty,
wet hole, filled with the ends of worms and an oozy smell, nor yet
a dry, bare, sandy hole with...
Drawn Text
In a hole in the ground there lived a hobbit. Not a nasty, dirty,
wet hole, filled with the ends of worms
|
|
|