summaryrefslogtreecommitdiffstats
path: root/apps/contacts/templates/part.cropphoto.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/contacts/templates/part.cropphoto.php')
-rw-r--r--apps/contacts/templates/part.cropphoto.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/apps/contacts/templates/part.cropphoto.php b/apps/contacts/templates/part.cropphoto.php
new file mode 100644
index 00000000000..cb416f0e415
--- /dev/null
+++ b/apps/contacts/templates/part.cropphoto.php
@@ -0,0 +1,62 @@
+<?php
+$id = $_['id'];
+$tmp_path = $_['tmp_path'];
+OC_Log::write('contacts','templates/part.cropphoto.php: tmp_path: '.$tmp_path.', exists: '.file_exists($tmp_path), OC_Log::DEBUG);
+?>
+<script language="Javascript">
+ jQuery(function($) {
+ $('#cropbox').Jcrop({
+ onChange: showCoords,
+ onSelect: showCoords,
+ onRelease: clearCoords,
+ maxSize: [399, 399],
+ bgColor: 'black',
+ bgOpacity: .4,
+ boxWidth: 400,
+ boxHeight: 400,
+ setSelect: [ 100, 130, 50, 50 ]//,
+ //aspectRatio: 0.8
+ });
+ });
+ // Simple event handler, called from onChange and onSelect
+ // event handlers, as per the Jcrop invocation above
+ function showCoords(c) {
+ $('#x1').val(c.x);
+ $('#y1').val(c.y);
+ $('#x2').val(c.x2);
+ $('#y2').val(c.y2);
+ $('#w').val(c.w);
+ $('#h').val(c.h);
+ };
+
+ function clearCoords() {
+ $('#coords input').val('');
+ };
+ /*
+ $('#coords').submit(function() {
+ alert('Handler for .submit() called.');
+ return true;
+ });*/
+</script>
+<img id="cropbox" src="<?php echo OC_Helper::linkTo('contacts', 'dynphoto.php', null, true); ?>?tmp_path=<?php echo urlencode($tmp_path); ?>" />
+<form id="cropform"
+ class="coords"
+ method="post"
+ enctype="multipart/form-data"
+ target="crop_target"
+ action="<?php echo OC_Helper::linkTo('contacts', 'ajax/savecrop.php', null, true); ?>">
+
+ <input type="hidden" id="id" name="id" value="<?php echo $id; ?>" />
+ <input type="hidden" id="tmp_path" name="tmp_path" value="<?php echo $tmp_path; ?>" />
+ <fieldset id="coords">
+ <input type="hidden" id="x1" name="x1" value="" />
+ <input type="hidden" id="y1" name="y1" value="" />
+ <input type="hidden" id="x2" name="x2" value="" />
+ <input type="hidden" id="y2" name="y2" value="" />
+ <input type="hidden" id="w" name="w" value="" />
+ <input type="hidden" id="h" name="h" value="" />
+ </fieldset>
+ <iframe name="crop_target" id='crop_target' src=""></iframe>
+</form>
+
+