Home  >  Article  >  Backend Development  >  jQuery image cropping plug-in Jcrop sample script

jQuery image cropping plug-in Jcrop sample script

WBOY
WBOYOriginal
2016-07-25 09:05:00880browse
  1. /**
  2. * jQuery image cropping plug-in Jcrop sample script
  3. * @copyright 2008 Kelly Hallman
  4. * This is translated and deleted by Zhang Xinxu to make it easier to understand and master
  5. */
  6. if ($_SERVER['REQUEST_METHOD'] == 'POST'){
  7. //$targ_w = $targ_h = 150; //保存的图片的大小
  8. $jpeg_quality = 90;
  9. $src = '../image/xuwanting.jpg';
  10. $img_r = imagecreatefromjpeg($src);
  11. $dst_r = ImageCreateTrueColor( $_POST['w'], $_POST['h'] );
  12. imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
  13. $_POST['w'],$_POST['h'],$_POST['w'],$_POST['h']);
  14. header('Content-type: image/jpeg');
  15. imagejpeg($dst_r,null,$jpeg_quality);
  16. exit;
  17. }
  18. ?>
复制代码


Statement:
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