//$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; $tmpkey = isset($_POST['tmpkey']) ? $_POST['tmpkey'] : ''; $id = isset($_POST['id']) ? $_POST['id'] : ''; if ($tmpkey == '') { bailOut('Missing key to temporary file.'); } if ($id == '') { bailOut('Missing contact id.'); } OCP\Util::writeLog('contacts', 'savecrop.php: key: ' . $tmpkey, OCP\Util::DEBUG); $data = OC_Cache::get($tmpkey); if ($data) { $image = new OC_Image(); if ($image->loadFromdata($data)) { $w = $w != -1 ? $w : $image->width(); $h = $h != -1 ? $h : $image->height(); OCP\Util::writeLog('contacts', 'savecrop.php, x: ' . $x1 . ' y: ' . $y1 . ' w: ' . $w . ' h: ' . $h, OCP\Util::DEBUG); if ($image->crop($x1, $y1, $w, $h)) { if ($image->width() <= 200 && $image->height() <= 200 || $image->resize(200)) { $vcard = OCA\Contacts\App::getContactVCard($id); if (!$vcard) { OC_Cache::remove($tmpkey); bailOut(OCA\Contacts\App::$l10n->t('Error getting contact object.')); } if ($vcard->__isset('PHOTO')) { OCP\Util::writeLog('contacts', 'savecrop.php: PHOTO property exists.', OCP\Util::DEBUG); $property = $vcard->__get('PHOTO'); if (!$property) { OC_Cache::remove($tmpkey);