jquery可转换的顶部和左侧位置

时间:2011-04-27 21:49:54

标签: php javascript jquery

我在一个页面中有两个图像第一个图像是一个大图像而第二个图像是一个小图像放在一个div上大图像小图像可以拖放和旋转到任何程度的大图像之后,我想将这两个图像保存为php中的一个图像

这是实时代码

http://jsfiddle.net/cQyvG/

但问题是,当我拖动小图像时,我无法在放置它的大图像上获取图像位置

这是我的PHP代码      photoRotation = $ _POST [“img_angle”];

$image_2 = imagecreatefrompng($sec);
$image_2 = imagerotate($image_2,$photoRotation, -1,0);
$image_1 = imagecreatefromjpeg($first);

imagecopy($image_1, $image_2,$_POST["img_left"],$_POST["img_top"], 0, 0, $_POST["img_width"],$_POST["img_hight"]);

这是有效的,但我总是在错误的位置得到第二张图片

jquery.transformable.js http://plugins.jquery.com/plugin-tags/jquerytransformablejs

1 个答案:

答案 0 :(得分:0)

尝试获取.offset(),而不是.position()

var position = p.offset();