Java acxImage

INDEX
Image format GIF



Sample 1 build GIF image
acxImage sample use for build a gif image.
Return



Source HTML
<img src="acxImage0.asp?format=gif">
Retour Index



Source ASP
<%
	imgFormat = Request("format") 
	iFormat = 0 
	if IsEmpty(Request("format") ) then
		imgFormat = "gif" 
	else
		imgFormat = Request("format") 
	end if

	if (imgFormat <> "gif") then
		if (imgFormat <> "png") then
			imgFormat = "png" 
		end if
	end if
			
	if (imgFormat = "png")  then
		iFormat = 1
	end if
 
	sScriptDir = Request.ServerVariables("SCRIPT_NAME")
	sScriptDir = StrReverse(sScriptDir)
	sScriptDir = Mid(sScriptDir, InStr(1, sScriptDir, "/"))
	sScriptDir = StrReverse(sScriptDir)
	
	' Set the virtual Directory
  	sPath = Server.MapPath(sScriptDir) & "\"


	Set h = Server.CreateObject("javaside.Rbl.acxImage") 

	h.init 250, 130
	h.newImage()

	' chemin absolue
	h.loadImage sPath & "javaside.gif", 0

	h.setColor 235, 235, 235 
	h.fillRect 0, 0, 250, 130
	
	h.setColor 55, 55, 255
	h.fillRect 35, 90, 80, 30

	h.drawImage 0, 140, 25

	h.setColor 255, 55, 55
	h.drawOval 135, 90, 80, 30

	h.setColor 0, 0, 0
	h.setFont "Verdana", 1, 22
	h.drawString "JavaSide.com...", 25, 82

	h.setFont "TimesRoman", 2, 18
	h.drawString "Times 16", 5, 36

	h.setColor 0, 0, 255
	h.setFont "Courier", 1, 14
	h.drawString "Courier 12 gras", 5, 52

	' On construit l image (paint suivant les donnees lu)
	h.build()

	
	' on genere l image 0 => GIF   1 => PNG
	img = h.getArray(iFormat)

	' h.saveAs( sPath & "cook2.gif")
	
	
	' ---- Response format -----------
	Response.Expires = 0 
	Response.Buffer = TRUE
	Response.Clear
	Response.contenttype = "image/" & imgFormat
	
	Response.BinaryWrite img

	Response.End
	' ----- End Response -------------

	h.clear()
	Set h = nothing 
%>
Retunr



Copyright © 1996..2002, R. BERTHOU. Tous droits réservés.
Dernière modification le 09 Aout 2002 09H26