ภาพแรกกับภาพ 2 อยู่คนละ form กันตอนนี้รูปแรก crop ได้รูป 2 crop ได้อยากได้ crop

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

offing
PHP VIP Members
PHP VIP Members
โพสต์: 1527
ลงทะเบียนเมื่อ: 18/08/2014 10:01 am

ภาพแรกกับภาพ 2 อยู่คนละ form กันตอนนี้รูปแรก crop ได้รูป 2 crop ได้อยากได้ crop

โพสต์ที่ยังไม่ได้อ่าน โดย offing »

ภาพแรกกับภาพ 2 อยู่คนละ form กันตอนนี้รูปแรก crop ได้รูป 2 crop ได้อยากได้ crop ได้ทั้งภาพแรกและภาพ 2 แต่ crop ทีละภาพ
1.gif
1.gif (65.18 KiB) Viewed 1283 times

โค้ด: เลือกทั้งหมด

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Live Cropping Demo</title>
  <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
  <script src="../../../styles/prosilver/theme/crop/jquery.min.js"></script>
  <script src="../../../styles/prosilver/theme/crop/jquery.Jcrop.js"></script>
  <link rel="stylesheet" href="../../../styles/prosilver/theme/crop/main.css" type="text/css" />
  <link rel="stylesheet" href="../../../styles/prosilver/theme/crop/demos.css" type="text/css" />
  <link rel="stylesheet" href="../../../styles/prosilver/theme/crop/jquery.Jcrop.css" type="text/css" />
  

<script type="text/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>
<script type="text/javascript">
    function show_crop()
    {
        topic_id = $('#topic_id').val();
//        x = $('#x').val(c.x);
//        y = $('#y').val(c.y);
//        w = $('#w').val(c.w);
//        h = $('#h').val(c.h);
       
        $("#topic_id_detail").load('tmbnews.php?mode=ajax_crop&topic_id='+topic_id);
    }
</script>
<div class="container">
<div class="jc-demo-box">
		<!-- This is the image we're attaching Jcrop to -->
<!--		<img src="../../../pictest/pool.jpg" id="cropbox" />-->

		<!-- This is the form that our event handler fills -->
		<form action="tmbnews.php?mode=ajax_crop&attach_id={PIC_ID}&topic_id={TOPIC_ID}&p={POST_ID}" method="post" onsubmit="return checkCoords();">
			<img src="{ATTACH_ID}" id="cropbox" />
                        <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="hidden" id="type" name="type" value="{TYPE}"/>
                        <input type="hidden" id="picture" name="picture" value="{ATTACH_ID}"/>
                        <input type="hidden" id="physical" name="physical" value="{PHYSICAL}"/>
                        
                        <button onclick="show_crop()">Crop Image</button>
<!--                        <input type="submit" value="Crop Image" class="show_crop" />-->
<!--			<input type="submit" value="Crop Image" class="btn btn-large btn-inverse" />-->
		</form>
                <form action="tmbnews.php?mode=ajax_crop&attach_id={PIC_ID}&topic_id={TOPIC_ID}&p={POST_ID}" method="post" onsubmit="return checkCoords();">
			<img src="{ATTACH_ID}" id="cropbox" />
                        <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="hidden" id="type" name="type" value="{TYPE}"/>
                        <input type="hidden" id="picture" name="picture" value="{ATTACH_ID}"/>
                        <input type="hidden" id="physical" name="physical" value="{PHYSICAL}"/>
                        
                        <button onclick="show_crop()">Crop Image</button>
<!--                        <input type="submit" value="Crop Image" class="show_crop" />-->
<!--			<input type="submit" value="Crop Image" class="btn btn-large btn-inverse" />-->
		</form>
</div>
</div>
</body>

</html>
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: Baidu [Spider] และบุคลทั่วไป 54