initial commit
[emacs-init.git] / nxhtml / tests / in / bug-290364.php
1 <?php
2 include 'HTML/QuickForm.php';
3
4 echo '<script type="text/javascript" src="library/javascript/prototype.js" language="javascript"></script>';
5 echo '<script type="text/javascript" src="library/javascript/scriptaculous.js" language="javascript"></script>';
6 echo '<script type="text/javascript" src="library/cropper/cropper.js" language="javascript"></script>';
7
8
9
10 echo '      <img src="test.jpg" alt="Test image" id="testImage" width="500" height="333" />';
11        
12 echo '          <script type="text/javascript" language="javascript">';
13
14 echo '      function onEndCrop( coords, dimensions ) {';
15 // echo '          $( "x1" ).value = coords.x1;';
16 // echo '          $( "y1" ).value = coords.y1;';
17 // echo '          $( "x2" ).value = coords.x2;';
18 // echo '          $( "y2" ).value = coords.y2;';
19 // echo '          $( "width" ).value = dimensions.width;';
20 // echo '          $( "height" ).value = dimensions.height;';
21 // echo 'console.log(coords.x1);';
22 // echo 'console.log(coords.x2);';
23 // echo ' style = clip:rect( + coords.x1 + "px " + coords.y1 + "px " + coords.x2 + "px " + coords.y2 + "px)\n"';
24 ?> 
25 style = "clip:rect(0px 130px 130px 0px)";
26 $("hidden_0").value = new Array (coords.x1, coords.x2, coords.y1, coords.y2);
27 $("testImage").writeAttribute("style=" style);
28 }
29 function js_init () {
30   Event.observe( "button_0", "click", function() {    } );
31   //  $("file_0").writeAttribute("src", "")
32   
33   new Cropper.Img("testImage", {minWidth: 220,previewWrap: "previewWrap", onEndCrop: onEndCrop });
34 }
35
36
37
38 Event.observe( window, "load", function() {
39     js_init ();
40   } );
41 ?>
42 echo '      </script>';
43
44 echo '<h1> Cropper votre image v0.1</h1>';
45
46 $label = 'file_default';
47
48 $form = new HTML_QuickForm ('cropper_form', "", "img-cropped.php", '', 'enctype=multipart/form-data');
49
50 $form->addElement ('file', 'file_0', $label);
51 $form->addElement ('hidden', 'hidden_0');
52 $form->addElement ('button', 'button_0');
53 $form->updateElementAttr(array('button_0'), array ('id' => 'button_0'));
54 $form->addElement ('submit', 'submit_0', 'Envoyer!');
55 $form->updateElementAttr(array('file_0'), array ('id' => 'file_0'));
56 $form->updateElementAttr(array('hidden_0'), array ('id' => 'hidden_0'));
57 echo $form->toHtml ();
58
59 if (isset ($_POST['file_0'])):
60 $image = $_POST['file_0'];
61 tmpfile ($image);
62 echo $_POST['file_0'];
63 endif;
64 echo sys_get_temp_dir ();
65 var_dump ($_POST);
66 ?>