]> git.mxchange.org Git - friendica.git/blob - library/cropper/tests/example-FixedRatio.htm
Merge branch 'master' of https://github.com/friendica/friendica
[friendica.git] / library / cropper / tests / example-FixedRatio.htm
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\r
3 <head>\r
4         <meta http-equiv="Content-type" content="text/html; charset=utf-8" />\r
5         <meta http-equiv="Content-Language" content="en-us" />\r
6         <title>Fixed ratio test</title>\r
7         <script src="../lib/prototype.js" type="text/javascript"></script>      \r
8         <script src="../lib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>\r
9         <script src="../cropper.js" type="text/javascript"></script>\r
10         \r
11         \r
12         <script type="text/javascript" charset="utf-8">\r
13                 \r
14                 function onEndCrop( coords, dimensions ) {\r
15                         $( 'x1' ).value = coords.x1;\r
16                         $( 'y1' ).value = coords.y1;\r
17                         $( 'x2' ).value = coords.x2;\r
18                         $( 'y2' ).value = coords.y2;\r
19                         $( 'width' ).value = dimensions.width;\r
20                         $( 'height' ).value = dimensions.height;\r
21                 }\r
22                 \r
23                 // with a supplied ratio\r
24                 Event.observe( \r
25                         window, \r
26                         'load', \r
27                         function() { \r
28                                 new Cropper.Img( \r
29                                         'testImage', \r
30                                         { \r
31                                                 ratioDim: { x: 220, y: 124 }, \r
32                                                 displayOnInit: true, \r
33                                                 onEndCrop: onEndCrop \r
34                                         } \r
35                                 ) \r
36                         } \r
37                 );\r
38                 \r
39                 /*\r
40                 if( typeof(dump) != 'function' ) {\r
41                         Debug.init(true, '/');\r
42                         \r
43                         function dump( msg ) {\r
44                                 // Debug.raise( msg );\r
45                         };\r
46                 } else dump( '---------------------------------------\n' );\r
47                 */\r
48                 \r
49         </script>\r
50         <link rel="stylesheet" type="text/css" href="debug.css" media="all" />\r
51         <style type="text/css">\r
52                 label { \r
53                         clear: left;\r
54                         margin-left: 50px;\r
55                         float: left;\r
56                         width: 5em;\r
57                 }\r
58                 \r
59                 #testWrap {\r
60                         margin: 20px 0 0 50px; /* Just while testing, to make sure we return the correct positions for the image & not the window */\r
61                 }\r
62         </style>\r
63 </head>\r
64 <body>  \r
65         <h2>Fixed ratio test</h2>\r
66         <p>\r
67                 Test of applying a fixed ratio to the cropper\r
68         </p>\r
69         <br />\r
70         \r
71         <div id="testWrap">\r
72                 <img src="castle.jpg" alt="test image" id="testImage" width="500" height="333" />\r
73         </div>\r
74         \r
75         \r
76         <p>\r
77                 <label for="x1">x1:</label>\r
78                 <input type="text" name="x1" id="x1" />\r
79         </p>\r
80         <p>\r
81                 <label for="y1">y1:</label>\r
82                 <input type="text" name="y1" id="y1" />\r
83         </p>\r
84         <p>\r
85                 <label for="x2">x2:</label>\r
86                 <input type="text" name="x2" id="x2" />\r
87         </p>\r
88         <p>\r
89                 <label for="y2">y2:</label>\r
90                 <input type="text" name="y2" id="y2" />\r
91         </p>\r
92         <p>\r
93                 <label for="width">width:</label>\r
94                 <input type="text" name="width" id="width" />\r
95         </p>\r
96         <p>\r
97                 <label for="height">height</label>\r
98                 <input type="text" name="height" id="height" />\r
99         </p>  \r
100         \r
101 </body>\r
102 </html>\r
103 \r
104 \r