summaryrefslogtreecommitdiffstats
path: root/apps/contacts/ajax/savecrop.php
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-04-22 13:19:12 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-04-22 13:19:12 +0200
commit4c2cf35050032002d01978f53201723330ebfe16 (patch)
treecb931972aae1381d0d46aa934fa56f462e4c873a /apps/contacts/ajax/savecrop.php
parent711aa229b882d3fc5e2fa8c22e6db2ec05642984 (diff)
parent1bba4456420d1824ab6d58f3d9bb523fcde5c4c2 (diff)
downloadnextcloud-server-4c2cf35050032002d01978f53201723330ebfe16.tar.gz
nextcloud-server-4c2cf35050032002d01978f53201723330ebfe16.zip
fix merge conflicts
Diffstat (limited to 'apps/contacts/ajax/savecrop.php')
-rw-r--r--apps/contacts/ajax/savecrop.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/contacts/ajax/savecrop.php b/apps/contacts/ajax/savecrop.php
index 36ba6a046dc..84c94da50b8 100644
--- a/apps/contacts/ajax/savecrop.php
+++ b/apps/contacts/ajax/savecrop.php
@@ -44,19 +44,15 @@ function bailOut($msg) {
$image = null;
-$x1 = (isset($_POST['x1']) && $_POST['x1']) ? $_POST['x1'] : -1;
+$x1 = (isset($_POST['x1']) && $_POST['x1']) ? $_POST['x1'] : 0;
//$x2 = isset($_POST['x2']) ? $_POST['x2'] : -1;
-$y1 = (isset($_POST['y1']) && $_POST['y1']) ? $_POST['y1'] : -1;
+$y1 = (isset($_POST['y1']) && $_POST['y1']) ? $_POST['y1'] : 0;
//$y2 = isset($_POST['y2']) ? $_POST['y2'] : -1;
$w = (isset($_POST['w']) && $_POST['w']) ? $_POST['w'] : -1;
$h = (isset($_POST['h']) && $_POST['h']) ? $_POST['h'] : -1;
$tmp_path = isset($_POST['tmp_path']) ? $_POST['tmp_path'] : '';
$id = isset($_POST['id']) ? $_POST['id'] : '';
-if(in_array(-1, array($x1, $y1, $w, $h))) {
- bailOut('Wrong crop dimensions: '.implode(', ', array($x1, $y1, $w, $h)));
-}
-
if($tmp_path == '') {
bailOut('Missing path to temporary file.');
}
@@ -70,6 +66,9 @@ OC_Log::write('contacts','savecrop.php: files: '.$tmp_path.' exists: '.file_exi
if(file_exists($tmp_path)) {
$image = new OC_Image();
if($image->loadFromFile($tmp_path)) {
+ $w = ($w != -1 ? $w : $image->width());
+ $h = ($h != -1 ? $h : $image->height());
+ OC_Log::write('contacts','savecrop.php, x: '.$x1.' y: '.$y1.' w: '.$w.' h: '.$h, OC_Log::DEBUG);
if($image->crop($x1, $y1, $w, $h)) {
if($image->resize(200)) {
$tmpfname = tempnam("/tmp", "occCropped"); // create a new file because of caching issues.
@@ -81,7 +80,7 @@ if(file_exists($tmp_path)) {
bailOut('Error getting contact object.');
}
if($card->__isset('PHOTO')) {
- OC_Log::write('contacts','savecrop.php: files: PHOTO property exists.', OC_Log::DEBUG);
+ OC_Log::write('contacts','savecrop.php: PHOTO property exists.', OC_Log::DEBUG);
$property = $card->__get('PHOTO');
if(!$property) {
unlink($tmpfname);