Home > Backend Development > PHP Tutorial > PHP online picture cutting program code_PHP tutorial

PHP online picture cutting program code_PHP tutorial

WBOY
Release: 2016-07-20 11:09:45
Original
2108 people have browsed it





php教程 在线切图程序代码<br>

<script><br>var mode = 1;<br>var inout = toubai = 0;<br>var img, imgurl = '', imgdata = '';<br>var p = '';<br>var xydir = 15;<br>var startangle=0, endangle=(math.pi/180)*270;<br>var m;<br>var win, wsp, canvas, c, canvastemp, ctemp, shapes;<br>var w,h,f;<br>var isshift = 0;<br>var shape = 0;<br>var theobject = null; <br>var dx, dy, dw, dh;<br>var des = '';<br>var iface = { dragging:false, resizing:false, status:null, xy:null, txy:null }<br>var anyt = 1;</p> <p>var isie = /msie/i.test(navigator.useragent);<br>var isff = /firefox/i.test(navigator.useragent);</p> <p>window.onload = function() <br>{  <br> win = document.getelementbyid('window');<br> wsp = document.getelementbyid('workspace');</p> <p> img = document.getelementbyid('myimg');<br> canvas = document.getelementbyid('canvas');<br> canvastemp = document.getelementbyid("canvastemp");<br> shapes = document.getelementbyid('shapes');<br> rects = document.getelementbyid('rect');<br> <br> win.style.left = document.body.clientwidth/2-425+'px';<br> if (canvas.getcontext) <br> {<br>  c = canvas.getcontext("2d");  <br>  c.linewidth = 1;<br>  c.strokestyle = '#f00'; <br>  c.fillstyle = "rgba(255,255,255,0.3)";<br>  c.strokefill = 1;</p> <p>  ctemp = canvastemp.getcontext("2d");<br>  ctemp.linewidth = 1;<br>  ctemp.strokestyle = '#f00';  <br>  ctemp.fillstyle = "rgba(255,255,255,0.3)";<br>  ctemp.strokefill = 1; <br>   <br>  var gradientcanvas = document.getelementbyid('gradient');<br>  if (gradientcanvas.getcontext) <br>  {<br>   var g = gradientcanvas.getcontext('2d');<br>   var grad = g.createlineargradient(0, 0, 1200, 22); <br>   grad.addcolorstop(0, '#036');<br>   grad.addcolorstop(1, '#acf');<br>   g.fillstyle = grad;<br>   g.fillrect(0, 0, 1200, 22);<br>  }<br>  <br>  iface.status = document.getelementbyid('status').firstchild;<br>  iface.xy = document.getelementbyid('xy').firstchild;<br>  iface.txy = document.getelementbyid('txy').firstchild;<br>  <br>  document.onmouseup = window.onmouseup = bodyup;<br>  document.onmousemove = window.onmousemove = bodymove;<br>  document.onkeydown = window.onkeydown = keydown;<br>  document.onkeyup = window.onkeyup = keyup;<br>  img.onmousedown = canvas.onmousedown = canvastemp.onmousedown = shapes.onmousedown = c_down;<br>  img.onmousemove = canvas.onmousemove = canvastemp.onmousemove = shapes.onmousemove = c_move;<br>  img.onmouseup = canvas.onmouseup = canvastemp.onmouseup = shapes.onmouseup = c_up;<br>  img.onmouseo教程ut = canvas.onmouseout = canvastemp.onmouseout = c_out;<br> }<br> else //不支持canvas属性<br> { <br>  alert('不支持canvas');   <br> }</p> <p>}</p> <p>function openimg() <br>{<br> var form = document.upimg;</p> <p> var file = form.ifile.value;<br> var pos = file.lastindexof('.');<br> var ext = file.substring(pos + 1).tolowercase();<br> if (ext != 'jpg' && ext != 'gif' && ext != 'bmp' && ext != 'png')<br> {<br>  alert('错误:上传图片必须是 jpg/gif/bmp/png 格式!');<br>  return;<br> }<br> form.submit.click();<br> document.getelementbyid('upimg').style.display = 'none';<br>}</p> <p>function upimg(url, size, ww, hh, ff) <br>{ <br> shape = 0;<br> des = '大小:'+size+' 字节 帧数:'+ff+' 帧 宽度:'+ww+' 像素 高度:'+hh+' 像素';<br> iface.status.innerhtml=des;<br> imgurl = url;<br> imgdata = 'imgurl='+imgurl+';';<br> if (ww>800) {w = 800; h = hh/(ww/800);}<br> else {w = ww; h= hh;} <br> f = ff;<br> //img.src = imgurl;<br> document.getelementbyid('myimg').style.display = 'block';<br> document.getelementbyid('myimg').src = imgurl;<br> canvas.style.display='block';<br> canvastemp.style.display='block';<br> canvas.width = canvastemp.width = w;<br> canvas.height = canvastemp.height = h;<br> canvas.style.width = canvastemp.style.width = w+'px';<br> canvas.style.height = canvastemp.style.height = h+'px';<br> c.clearrect(0, 0, canvas.width, canvas.height);<br> ctemp.clearrect(0, 0, canvastemp.width, canvastemp.height);<br> c.strokestyle = '#f00'; <br> c.fillstyle = "rgba(255,255,255,0.3)";<br> ctemp.strokestyle = '#f00';  <br> ctemp.fillstyle = "rgba(255,255,255,0.3)";<br>}</p> <p>function init(t)<br>{<br> if (imgurl == '') {alert('请先上传图片!');return;}<br> else alert("当前版本是演示版!");<br>}<br>function reset()<br>{<br> if (imgurl == '') {alert('请先上传图片!');return;}<br> else alert("当前版本是演示版!");<br>}<br>function clip() <br>{ <br> if (imgurl == '') {alert('请先上传图片!');return;}<br> else alert("当前版本是演示版!");<br>}</p> <p>function hover(o)<br>{<br> o.style.border = "1px solid";<br> o.style.bordercolor = "threedhighlight threeddarkshadow threeddarkshadow threedhighlight";<br>}<br>function hoverout(o)<br>{<br> o.style.border = "0px solid transparent";<br>}</p> <p>function help()<br>{<br> document.getelementbyid('help').style.display='block';<br>}<br>function about()<br>{<br> document.getelementbyid('about').style.display='block';<br>}<br>function wrong(str)<br>{<br> alert(str);<br>}<br></script>


 

图片裁剪工具

操作说明 关于我们


 

 
   
 

  
  
  
  

   
  

 

 


  

  

  

 

 

 


 
 
 
 

  
操作说明

  
【鼠标操作说明】

[1] 鼠标拖动裁剪框可移动裁剪区域的位置,此操作适用于矩形裁剪,圆形裁剪,圆角矩形裁剪,圆弧裁剪。

[2] 鼠标拉拽裁剪框边框可调整裁剪区域的大小,此操作适用于矩形裁剪,圆形裁剪,圆角矩形裁剪,圆弧裁剪。

【键盘操作说明】

[3] 按←↑↓→键可精确移动裁剪区域的位置,此操作适用于矩形裁剪,圆形裁剪,圆角矩形裁剪,圆弧裁剪。

[4] 按jklm键可精确调整裁剪区域的大小,此操作适用于矩形裁剪,圆形裁剪,圆角矩形裁剪,圆弧裁剪。

[5] 按a键减小圆角矩形的圆角角度,按d键增大圆角矩形的圆角角度,此操作适用于圆角矩形裁剪。

[6] 按awsd键可调整圆弧的弧度,此操作适用于圆弧裁剪。

【shift操作说明】

[7] 拉拽鼠标的同时按shift键可按宽与高1:1的比例调整裁剪区域的大小,此操作适用于矩形裁剪,圆形裁剪,圆角矩形裁剪。


 

 
 
 
 

  
 
 
 


upload.php文件
 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  "";
  }
  else
  {
   $filename = "upload/".date("ymdhis",time()).rand(100,999).substr($_files["ifile"]["name"],strrpos($_files["ifile"]["name"],'.'));
   move_uploaded_file($_files["ifile"]["tmp_name"], $filename);
   
   $magick_wand = newmagickwand();
   magickreadimage($magick_wand, $filename);
   $w = magickgetimagewidth($magick_wand);
   $h = magickgetimageheight($magick_wand);
   $f = magickgetnumberimages($magick_wand);
   
   echo  "";
  }
 }
 else
 {
  echo  "";
 }
?>

源码下载地址
http://down.php100.com/php/2011/0311/22879.html


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/444793.htmlTechArticle!doctype html public -//w3c//dtd xhtml 1.0 transitional//en http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml head meta http-equiv=con...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template