mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-11-29 11:24:11 +01:00
Avoid warnings when setting image type
This commit is contained in:
parent
0677ded722
commit
8020285970
@ -68,7 +68,7 @@ if(!$contact) {
|
|||||||
|
|
||||||
$data = \OC_Cache::get($tmpkey);
|
$data = \OC_Cache::get($tmpkey);
|
||||||
if($data) {
|
if($data) {
|
||||||
$image = new \OC_Image();
|
$image = new \OCP\Image();
|
||||||
if($image->loadFromData($data)) {
|
if($image->loadFromData($data)) {
|
||||||
$w = ($w != -1 ? $w : $image->width());
|
$w = ($w != -1 ? $w : $image->width());
|
||||||
$h = ($h != -1 ? $h : $image->height());
|
$h = ($h != -1 ? $h : $image->height());
|
||||||
@ -82,9 +82,12 @@ if($data) {
|
|||||||
// For vCard 3.0 the type must be e.g. JPEG or PNG
|
// For vCard 3.0 the type must be e.g. JPEG or PNG
|
||||||
// For version 4.0 the full mimetype should be used.
|
// For version 4.0 the full mimetype should be used.
|
||||||
// https://tools.ietf.org/html/rfc2426#section-3.1.4
|
// https://tools.ietf.org/html/rfc2426#section-3.1.4
|
||||||
$type = strval($contact->VERSION) === '4.0'
|
if(strval($contact->VERSION) === '4.0') {
|
||||||
? $image->mimeType()
|
$type = $image->mimeType();
|
||||||
: strtoupper(array_pop(explode('/', $image->mimeType())));
|
} else {
|
||||||
|
$type = explode('/', $image->mimeType());
|
||||||
|
$type = strtoupper(array_pop($type));
|
||||||
|
}
|
||||||
if(isset($contact->PHOTO)) {
|
if(isset($contact->PHOTO)) {
|
||||||
\OCP\Util::writeLog('contacts',
|
\OCP\Util::writeLog('contacts',
|
||||||
'savecrop.php: PHOTO property exists.',
|
'savecrop.php: PHOTO property exists.',
|
||||||
|
Loading…
Reference in New Issue
Block a user