Last active
December 14, 2015 12:38
-
-
Save richardhughes260/5087437 to your computer and use it in GitHub Desktop.
CFML Target generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <cfparam name="url.height" default="700"> | |
| <cfparam name="url.colorForeground" default="000000"> | |
| <cfparam name="url.colorBackground" default="FFFFFF"> | |
| <cfsetting showdebugoutput="false"/> | |
| <cfif structKeyExists(url,"custom")> | |
| <cfscript> | |
| //url.height=420; | |
| thickness=int(url.height/150); | |
| lineWidth= thickness; | |
| widthCircle= thickness; | |
| widthLineWhiteCircle= thickness; | |
| width=url.height; | |
| center=url.height/2; | |
| widthCircleOne=url.height*.92; | |
| widthCircleTwo=url.height*.66; | |
| widthCircleThree=url.height*.42; | |
| widthWhiteCircle=url.height*.24; | |
| myImage=ImageNew("",width,url.height,"RGB",url.colorBackground ); | |
| ImageSetDrawingColor(myImage,url.colorForeground); | |
| ImageSetAntialiasing(myImage,"on"); | |
| attr=StructNew(); | |
| attr.width = widthCircle; | |
| ImageSetDrawingStroke(myImage,attr); | |
| ImageDrawRect(myImage,0,0,url.height-1,url.height-1); | |
| ImageSetDrawingColor(myImage,url.colorForeground); | |
| //circle one | |
| ImageDrawOval(myImage,(url.height-widthCircleOne)/2,(url.height-widthCircleOne)/2,widthCircleOne,widthCircleOne); | |
| //circle two | |
| ImageDrawOval(myImage,(url.height-widthCircleTwo)/2,(url.height-widthCircleTwo)/2,widthCircleTwo,widthCircleTwo); | |
| //Inner solid circle | |
| ImageDrawOval(myImage,(url.height-widthCircleThree)/2,(url.height-widthCircleThree)/2,widthCircleThree,widthCircleThree,true); | |
| attr.width = widthLineWhiteCircle; | |
| ImageSetDrawingStroke(myImage,attr); | |
| ImageSetDrawingColor(myImage,url.colorBackground); | |
| ImageDrawOval(myImage,(url.height-widthWhiteCircle)/2,(url.height-widthWhiteCircle)/2,widthWhiteCircle,widthWhiteCircle); | |
| ImageSetDrawingColor(myImage,url.colorForeground); | |
| attr.width = lineWidth; | |
| ImageSetDrawingStroke(myImage,attr); | |
| //left horiz black line | |
| ImageDrawLine(myImage,0,center,center-(widthCircleThree/2),center); | |
| //right horiz black line | |
| ImageDrawLine(myImage,center+(widthCircleThree/2),center,url.height,center); | |
| //horiz white line | |
| ImageSetDrawingColor(myImage,url.colorBackground); | |
| ImageDrawLine(myImage,center-(widthCircleThree/2),center,center+(widthCircleThree/2),center); | |
| ImageSetDrawingColor(myImage,url.colorForeground); | |
| //top vert black line | |
| ImageDrawLine(myImage,center,0,center,center-(widthCircleThree/2)); | |
| //bot vert black line | |
| ImageDrawLine(myImage,center,center+(widthCircleThree/2),center,url.height); | |
| //vert white line | |
| ImageSetDrawingColor(myImage,url.colorBackground); | |
| ImageDrawLine(myImage,center,center-(widthCircleThree/2),center,center+(widthCircleThree/2)); | |
| </cfscript> | |
| <!--- Display the image in a browser. ---> | |
| <cfoutput> | |
| <a href="?height=#url.height#&colorForeground=#url.colorForeground#&colorBackground=#url.colorBackground#"> | |
| </cfoutput> | |
| <cfimage source="#myImage#" action="writeToBrowser"> | |
| </a> | |
| <cfelse> | |
| <cfoutput> | |
| <form action="?"> | |
| <input name="colorForeground" value="#url.colorForeground#"> Forground <br> | |
| <input name="colorBackground" value="#url.colorBackground#"> Background <br> | |
| <input name="height" value="#url.height#"> height <br> | |
| <input type="hidden" name="custom" value="1"> | |
| <input type="submit"> | |
| </form> | |
| </cfoutput> | |
| </cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment