| w3Image Examples |
Create a text in an image from an URL |
| Generating a dynamic image with from a URL is really simple with w3Image 2.0 |
Test.htm
<html>
<head><title>Test</title></head> <body> Image Test:<br /> <imgsrc="showImage.asp"width="320" height="240" alt= "" border="0"/><br/> </body> </html> |
showimage.asp<%@ LANGUAGE="VBSCRIPT" %> <% ' /////////////////////////////////////////////////////////////////// ' // Generating Dynamic Images with image on the Internet ' // with w3Image 2.0 ' // ' // Out: An Image to Response Object ' // ' ////////////////////////////////////////////////////////////////// Set oImage = Server.CreateObject("W3Image.Image '// Remember to change the URL bellow to your own URL
oImage.CreateEmptySurface 1,1oImage.LoadImageFromUrl "http://www.my-server.net/myimage.jpg" oImage.SetFont objFont strText = "/Preview image/" '// Get the center of the picture
intTop = ((oImage.Height - oImage.GetTextHeight(strText))/2)intLeft = ((oImage.Width - oImage.GetTextWidth(strText))/2) '// Check if the Top or Left pixels are less than 0
If intTop < 0 Then intTop = 0If intLeft < 0 Then intLeft = 0 oImage.SetFont objFont oImage.DrawText strText, intLeft, intTop ' // Stream image to response as JPEG-image.
Response.ClearResponse.ContentType = "image/jpeg" oImage.StreamImage Response, "JPG", 24 %> |