<?php
/**
* Jcrop image cropping plugin for jQuery
* Example cropping script
* @copyright 2008 Kelly Hallman
* More info: http://deepliquid.com/content/Jcrop_Implementation_Theory.html
*/
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$targ_w = $targ_h = 150;
$jpeg_quality = 90;
$src = 'demo_files/flowers.jpg';
$img_r = imagecreatefromjpeg($src);
$dst_r = ImageCreateTrueColor( $targ_w, $targ_h );
imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
$targ_w,$targ_h,$_POST['w'],$_POST['h']);
header('Content-type: image/jpeg');
imagejpeg($dst_r,null,$jpeg_quality);
exit;
}
// If not a POST request, display page below:
?><html>
<head>
<script src="../js/jquery.pack.js"></script>
<script src="../js/jquery.Jcrop.pack.js"></script>
<link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
<link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
<script language="Javascript">
$(function(){
$('#cropbox').Jcrop({
aspectRatio: 1,
onSelect: updateCoords
});
});
function updateCoords(c)
{
$('#x').val(c.x);
$('#y').val(c.y);
$('#w').val(c.w);
$('#h').val(c.h);
};
function checkCoords()
{
if (parseInt($('#w').val())) return true;
alert('Please select a crop region then press submit.');
return false;
};
</script>
</head>
<body>
<div id="outer">
<div class="jcExample">
<div class="article">
<h1>Jcrop - Crop Behavior</h1>
<!-- This is the image we're attaching Jcrop to -->
<img src="demo_files/flowers.jpg" id="cropbox" />
<!-- This is the form that our event handler fills -->
<form action="crop.php" method="post" onsubmit="return checkCoords();">
<input type="hidden" id="x" name="x" />
<input type="hidden" id="y" name="y" />
<input type="hidden" id="w" name="w" />
<input type="hidden" id="h" name="h" />
<input type="submit" value="Crop Image" />
</form>
<p>
<b>An example server-side crop script.</b> Hidden form values
are set when a selection is made. If you press the <i>Crop Image</i>
button, the form will be submitted and a 150x150 thumbnail will be
dumped to the browser. Try it!
</p>
<div id="dl_links">
<a href="http://deepliquid.com/content/Jcrop.html">Jcrop Home</a> |
<a href="http://deepliquid.com/content/Jcrop_Manual.html">Manual (Docs)</a>
</div>
</div>
</div>
</div>
</body>
</html>
没有合适的资源?快使用搜索试试~ 我知道了~
Jcrop 基于jquery的图片裁剪插件.zip
共18个文件
html:7个
jpg:3个
js:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 79 浏览量
2022-11-04
23:59:26
上传
评论
收藏 199KB ZIP 举报
温馨提示
Jcrop 基于jquery的图片裁剪插件.zip
资源推荐
资源详情
资源评论
收起资源包目录
Jcrop 基于jquery的图片裁剪插件.zip (18个子文件)
132692101385270605
服务器常用软件.html 61B
Jcrop
css
Jcrop.gif 329B
jquery.Jcrop.css 748B
demos
tutorial5.html 5KB
tutorial1.html 956B
crop.php 2KB
tutorial3.html 2KB
tutorial2.html 2KB
demo_files
sagomod.jpg 16KB
sago.jpg 18KB
demos.css 558B
flowers.jpg 45KB
sagomod.png 77KB
tutorial4.html 2KB
index.html 2KB
js
jquery.min.js 56KB
jquery.Jcrop.min.js 17KB
jquery.Jcrop.js 25KB
共 18 条
- 1
资源评论
易小侠
- 粉丝: 6475
- 资源: 9万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功