1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Use OCP\Image

This commit is contained in:
Thomas Tanghus 2013-08-29 17:46:37 +02:00
parent db24d26e7d
commit 1a24590322
4 changed files with 7 additions and 12 deletions

View File

@ -9,9 +9,4 @@
<description>Address book with CardDAV support.</description>
<standalone/>
<default_enable/>
<remote>
<contacts>appinfo/remote.php</contacts>
<carddav>appinfo/remote.php</carddav>
<contactthumbnail>thumbnail.php</contactthumbnail>
</remote>
</info>

View File

@ -672,7 +672,7 @@ class Contact extends VObject\VCard implements IPIMObject {
}
// TODO: Cleanup these parameters
public function cacheThumbnail(\OC_Image $image = null, $remove = false, $update = false) {
public function cacheThumbnail(\OCP\Image $image = null, $remove = false, $update = false) {
$key = self::THUMBNAIL_PREFIX . $this->combinedKey();
//\OC_Cache::remove($key);
if(\OC_Cache::hasKey($key) && $image === null && $remove === false && $update === false) {
@ -686,7 +686,7 @@ class Contact extends VObject\VCard implements IPIMObject {
}
if(is_null($image)) {
$this->retrieve();
$image = new \OC_Image();
$image = new \OCP\Image();
if(!isset($this->PHOTO) && !isset($this->LOGO)) {
return false;
}
@ -698,13 +698,13 @@ class Contact extends VObject\VCard implements IPIMObject {
}
if(!$image->centerCrop()) {
\OCP\Util::writeLog('contacts',
'thumbnail.php. Couldn\'t crop thumbnail for ID ' . $key,
__METHOD__ .'. Couldn\'t crop thumbnail for ID ' . $key,
\OCP\Util::ERROR);
return false;
}
if(!$image->resize(self::THUMBNAIL_SIZE)) {
\OCP\Util::writeLog('contacts',
'thumbnail.php. Couldn\'t resize thumbnail for ID ' . $key,
__METHOD__ . '. Couldn\'t resize thumbnail for ID ' . $key,
\OCP\Util::ERROR);
return false;
}

View File

@ -129,7 +129,7 @@ class ContactController extends BaseController {
return $response;
}
$image = new \OC_Image();
$image = new \OCP\Image();
if (isset($contact->PHOTO) && $image->loadFromBase64((string)$contact->PHOTO)) {
// OK
$etag = md5($contact->PHOTO);

View File

@ -16,7 +16,7 @@ use OCA\AppFramework\Http\Response;
*/
class ImageResponse extends Response {
/**
* @var OC_Image
* @var OCP\Image
*/
protected $image;
@ -25,7 +25,7 @@ class ImageResponse extends Response {
$this->setImage($image);
}
public function setImage(\OC_Image $image) {
public function setImage(\OCP\Image $image) {
if(!$image->valid()) {
throw new InvalidArgumentException(__METHOD__. ' The image resource is not valid.');
}