Php online graph cutting program code .! Doctypehtmlpublic-w3cdtdxhtml1.0transitionalenwww.w3.orgtrxhtml1dtdxhtml1-transitional.dtdhtmlxmlnswww.w3.org1999xhtmlheadmetahttp-equivcon
Php code for online graph cutting <br/>
Script
Var mode = 1;
Var inout = toubai = 0;
Var img, imgurl = '', imgdata = '';
Var p = '';
Var xydir = 15;
Var startangle = 0, endangle = (math. pi/180) * 270;
Var m;
Var win, wsp, canvas, c, canvastemp, ctemp, shapes;
Var w, h, f;
Var isshift = 0;
Var shape = 0;
Var theobject = null;
Var dx, dy, dw, dh;
Var des = '';
Var iface = {dragging: false, resizing: false, status: null, xy: null, txy: null}
Var anyt = 1;
Var isie =/msie/I. test (navigator. useragent );
Var isff =/firefox/I. test (navigator. useragent );
Window. onload = function ()
{
Win = document. getelementbyid ('window ');
Wsp = document. getelementbyid ('workspace ');
Img = document. getelementbyid ('myimg ');
Canvas = document. getelementbyid ('canvas ');
Canvastemp = document. getelementbyid ("canvastemp ");
Shapes = document. getelementbyid ('shapes ');
Rects = document. getelementbyid ('rect ');
Win. style. left = document. body. clientwidth/2-425 + 'px ';
If (canvas. getcontext)
{
C = canvas. getcontext ("2d ");
C. linewidth = 1;
C. strokestyle = '# f00 ';
C. fillstyle = "rgba (255,255,255, 0.3 )";
C. strokefill = 1;
Ctemp = canvastemp. getcontext ("2d ");
Ctemp. linewidth = 1;
Ctemp. strokestyle = '# f00 ';
Ctemp. fillstyle = "rgba (255,255,255, 0.3 )";
Ctemp. strokefill = 1;
Var gradientcanvas = document. getelementbyid ('gradient ');
If (gradientcanvas. getcontext)
{
Var g = gradientcanvas. getcontext ('2D ');
Var grad = g. createlineargradient (0, 0, 1200, 22 );
Grad. addcolorstop (0, '#036 ');
Grad. addcolorstop (1, '# acf ');
G. fillstyle = grad;
G. fillrect (0, 0, 1200, 22 );
}
Iface. status = document. getelementbyid ('status'). firstchild;
Iface. xy = document. getelementbyid ('XY'). firstchild;
Iface. txy = document. getelementbyid ('txy'). firstchild;
Document. onmouseup = window. onmouseup = bodyup;
Document. onmousemove = window. onmousemove = bodymove;
Document. onkeydown = window. onkeydown = keydown;
Document. onkeyup = window. onkeyup = keyup;
Img. onmousedown = canvas. onmousedown = canvastemp. onmousedown = shapes. onmousedown = c_down;
Img. onmousemove = canvas. onmousemove = canvastemp. onmousemove = shapes. onmousemove = c_move;
Img. onmouseup = canvas. onmouseup = canvastemp. onmouseup = shapes. onmouseup = c_up;
Img. onmouseo tutorial ut = canvas. onmouseout = canvastemp. onmouseout = c_out;
}
Else // The canvas attribute is not supported.
{
Alert ('canvas not supported ');
}
}
Function openimg ()
{
Var form = document. upimg;
Var file = form. ifile. value;
Var pos = file. lastindexof ('.');
Var ext = file. substring (pos + 1). tolowercase ();
If (ext! = 'Jpg '& ext! = 'GIF' & ext! = 'Bmp '& ext! = 'PNG ')
{
Alert ('Error: the uploaded image must be in jpg/gif/bmp/png format! ');
Return;
}
Form. submit. click ();
Document. getelementbyid ('upimg '). style. display = 'none ';
}
Function upimg (url, size, ww, hh, ff)
{
Shape = 0;
Des = 'Size: '+ size +' number of bytes of frames: '+ ff +' frame width: '+ ww +' pixel height: '+ hh + 'Pixels ';
Iface. status. innerhtml = des;
Imgurl = url;
Imgdata = 'imgurl = '+ imgurl + ';';
If (ww> 800) {w = 800; h = hh/(ww/800 );}
Else {w = ww; h = hh ;}
F = ff;
// Img. src = imgurl;
Document. getelementbyid ('myimg '). style. display = 'block ';
Document. getelementbyid ('myimg '). src = imgurl;
Canvas. style. display = 'block ';
Canvastemp. style. display = 'block ';
Canvas. width = canvastemp. width = w;
Canvas. height = canvastemp. height = h;
Canvas. style. width = canvastemp. style. width = w + 'px ';
Canvas. style. height = canvastemp. style. height = h + 'px ';
C. clearrect (0, 0, canvas. width, canvas. height );
Ctemp. clearrect (0, 0, canvastemp. width, canvastemp. height );
C. strokestyle = '# f00 ';
C. fillstyle = "rgba (255,255,255, 0.3 )";
Ctemp. strokestyle = '# f00 ';
Ctemp. fillstyle = "rgba (255,255,255, 0.3 )";
}
Function init (t)
{
If (imgurl = '') {alert ('upload the image first! '); Return ;}
Else alert ("The current version is the demo version! ");
}
Function reset ()
{
If (imgurl = '') {alert ('upload the image first! '); Return ;}
Else alert ("The current version is the demo version! ");
}
Function clip ()
{
If (imgurl = '') {alert ('upload the image first! '); Return ;}
Else alert ("The current version is the demo version! ");
}
Function hover (o)
{
O. style. border = "1px solid ";
O. style. bordercolor = "threedhighlight threeddarkshadow threedhighlight ";
}
Function hoverout (o)
{
O. style. border = "0px solid transparent ";
}
Function help ()
{
Document. getelementbyid ('help'). style. display = 'block ';
}
Function about ()
{
Document. getelementbyid ('about'). style. display = 'block ';
}
Function wrong (str)
{
Alert (str );
}
Script
Image cropping tool operation instructions about us
- Upload an image (U)
- Rectangular crop (R)
- Circular crop (O)
- Cropped rounded rectangle (C)
- Arc crop (A)
- Polygon cropping
- Straight edgeQu Bian
- Crop any image (M)
- Crop
- Reset
- Set
Operation instructions
[Mouse operation instructions]
[1] move the mouse to the position of the cropped area. this operation is applicable to rectangular, circular, rounded, and arc cropping.
[2] you can drag and drop the border of the crop box to adjust the size of the crop area. this operation is applicable to rectangular crop, circular crop, rounded rectangle crop, and arc crop.
[Keyboard operation instructions]
[3] press the crop Crop button to precisely move the position of the crop area. this operation applies to rectangular crop, circular crop, rounded rectangle crop, and circular arc crop.
[4] press the jklm key to precisely adjust the size of the crop area. this operation is applicable to rectangular crop, circular crop, rounded rectangle crop, and circular arc crop.
[5] press the key to reduce the rounded corner angle of the rounded corner rectangle, and press the d key to increase the rounded corner angle of the rounded corner rectangle. this operation is applicable to corner rectangular cropping.
[6] press the awsd key to adjust the arc radians. this operation applies to arc crop.
[Shift operation instructions]
[7] when you pull the mouse and press shift, you can adjust the size of the cropping area by ratio of width to height. this operation is applicable to rectangular cropping, circular cropping, and rounded rectangular cropping.
About Us
[Purpose of this site]
● This site aims to provide users with the most professional and comprehensive Image cropping service.
Site description]
● This site provides the following services: Image cropping, photo cropping, rectangular cropping, circular cropping, arc cropping, Polygon cropping, arbitrary image cropping, and dynamic image cropping.
[Contact Us]
● If you have any questions about this site, please contact us: service@caijian.cc.
Upload. php file
If (stripos ($ _ server ["http_host"], 'caijian. cc') = false) exit (0 );
If ($ _ files ["ifile"] ["type"] = "image/gif ")
| ($ _ Files ["ifile"] ["type"] = "image/jpeg ")
| ($ _ Files ["ifile"] ["type"] = "image/pjpeg ")
| ($ _ Files ["ifile"] ["type"] = "image/bmp ")
| ($ _ Files ["ifile"] ["type"] = "image/png "))
& ($ _ Files ["ifile"] ["size"] <3000000 ))
{
If ($ _ files ["ifile"] ["error"]> 0)
{
Echo"