From fc52af24f1418d6590a2d37a0d8cc31b123e38f6 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli <thomas@roundcube.net> Date: Tue, 19 Aug 2014 12:08:35 -0400 Subject: [PATCH] Fix merge error that disabled contact drag'n'drop --- program/steps/addressbook/upload_photo.inc | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/program/steps/addressbook/upload_photo.inc b/program/steps/addressbook/upload_photo.inc index 039a7b2..035d67e 100644 --- a/program/steps/addressbook/upload_photo.inc +++ b/program/steps/addressbook/upload_photo.inc @@ -17,9 +17,6 @@ +-----------------------------------------------------------------------+ | Author: Thomas Bruederli <roundcube@gmail.com> | +-----------------------------------------------------------------------+ - - $Id$ - */ // Supported image format types @@ -31,20 +28,19 @@ if ($filepath = $_FILES['_photo']['tmp_name']) { // check file type and resize image - $imageprop = rcmail::imageprops($_FILES['_photo']['tmp_name']); + $image = new rcube_image($_FILES['_photo']['tmp_name']); + $imageprop = $image->props(); if (in_array(strtolower($imageprop['type']), $IMAGE_TYPES) - && $imageprop['width'] && $imageprop['height'] + && $imageprop['width'] && $imageprop['height'] ) { - $maxsize = intval($RCMAIL->config->get('contact_photo_size', 160)); - $tmpfname = tempnam($RCMAIL->config->get('temp_dir'), 'rcmImgConvert'); + $maxsize = intval($RCMAIL->config->get('contact_photo_size', 160)); + $tmpfname = tempnam($RCMAIL->config->get('temp_dir'), 'rcmImgConvert'); $save_hook = 'attachment_upload'; // scale image to a maximum size - if (($imageprop['width'] > $maxsize || $imageprop['height'] > $maxsize) && - (rcmail::imageconvert(array('in' => $filepath, 'out' => $tmpfname, - 'size' => $maxsize.'x'.$maxsize, 'type' => $imageprop['type'])) !== false)) { - $filepath = $tmpfname; + if (($imageprop['width'] > $maxsize || $imageprop['height'] > $maxsize) && $image->resize($maxsize, $tmpfname)) { + $filepath = $tmpfname; $save_hook = 'attachment_save'; } @@ -57,8 +53,9 @@ 'group' => 'contact', )); } - else + else { $attachment['error'] = rcube_label('invalidimageformat'); + } if ($attachment['status'] && !$attachment['abort']) { $file_id = $attachment['id']; -- Gitblit v1.9.1