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

server => cache in ContactPhotoController

This commit is contained in:
Thomas Tanghus 2014-04-07 23:21:12 +02:00
parent 70438c997d
commit 8dcd7a7d8b

View File

@ -79,7 +79,7 @@ class ContactPhotoController extends Controller {
$response = new JSONResponse(); $response = new JSONResponse();
$tempPhoto = TemporaryPhoto::create( $tempPhoto = TemporaryPhoto::create(
$this->server, $this->cache,
TemporaryPhoto::PHOTO_UPLOADED, TemporaryPhoto::PHOTO_UPLOADED,
$this->request $this->request
); );
@ -109,7 +109,7 @@ class ContactPhotoController extends Controller {
$contact = $addressBook->getChild($params['contactId']); $contact = $addressBook->getChild($params['contactId']);
$tempPhoto = TemporaryPhoto::create( $tempPhoto = TemporaryPhoto::create(
$this->server, $this->cache,
TemporaryPhoto::PHOTO_CURRENT, TemporaryPhoto::PHOTO_CURRENT,
$contact $contact
); );
@ -140,7 +140,7 @@ class ContactPhotoController extends Controller {
} }
$tempPhoto = TemporaryPhoto::create( $tempPhoto = TemporaryPhoto::create(
$this->server, $this->cache,
TemporaryPhoto::PHOTO_FILESYSTEM, TemporaryPhoto::PHOTO_FILESYSTEM,
$this->request->get['path'] $this->request->get['path']
); );
@ -164,7 +164,7 @@ class ContactPhotoController extends Controller {
$params = $this->request->urlParams; $params = $this->request->urlParams;
$tmpkey = $params['key']; $tmpkey = $params['key'];
$tmpPhoto = new TemporaryPhoto($this->server, $tmpkey); $tmpPhoto = new TemporaryPhoto($this->cache, $tmpkey);
$image = $tmpPhoto->getPhoto(); $image = $tmpPhoto->getPhoto();
if($image->valid()) { if($image->valid()) {
@ -189,13 +189,13 @@ class ContactPhotoController extends Controller {
$h = (isset($this->request->post['h']) && $this->request->post['h']) ? $this->request->post['h'] : -1; $h = (isset($this->request->post['h']) && $this->request->post['h']) ? $this->request->post['h'] : -1;
$tmpkey = $params['key']; $tmpkey = $params['key'];
$app = new App($this->api->getUserId()); $app = new App(\OCP\User::getUser());
$addressBook = $app->getAddressBook($params['backend'], $params['addressBookId']); $addressBook = $app->getAddressBook($params['backend'], $params['addressBookId']);
$contact = $addressBook->getChild($params['contactId']); $contact = $addressBook->getChild($params['contactId']);
$response = new JSONResponse(); $response = new JSONResponse();
$tmpPhoto = new TemporaryPhoto($this->server, $tmpkey); $tmpPhoto = new TemporaryPhoto($this->cache, $tmpkey);
$image = $tmpPhoto->getPhoto(); $image = $tmpPhoto->getPhoto();
if(!$image || !$image->valid()) { if(!$image || !$image->valid()) {
return $response->bailOut(App::$l10n->t('Error loading image from cache')); return $response->bailOut(App::$l10n->t('Error loading image from cache'));