summaryrefslogtreecommitdiffstats
path: root/apps/gallery/ajax
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-05-09 22:47:57 +0200
committerBart Visscher <bartv@thisnet.nl>2012-05-10 09:14:27 +0200
commit9a66b869c0db189338ccf0333183108bf81a7786 (patch)
tree805baf92708cd0d415d3178a8de40f9f1bcbb3d3 /apps/gallery/ajax
parentc2230580c14b08877210a9c0bcfe6f4b0a806bf5 (diff)
downloadnextcloud-server-9a66b869c0db189338ccf0333183108bf81a7786.tar.gz
nextcloud-server-9a66b869c0db189338ccf0333183108bf81a7786.zip
Gallery: Use App storage instead of contructing our own path
Diffstat (limited to 'apps/gallery/ajax')
-rwxr-xr-xapps/gallery/ajax/galleryOp.php3
-rwxr-xr-xapps/gallery/ajax/sharing.php6
2 files changed, 6 insertions, 3 deletions
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php
index 0cd825f3e50..b49e52f0bd2 100755
--- a/apps/gallery/ajax/galleryOp.php
+++ b/apps/gallery/ajax/galleryOp.php
@@ -42,7 +42,8 @@ function handleRemove($name) {
function handleGetThumbnails($albumname) {
OCP\Response::enableCaching(3600 * 24); // 24 hour
- $thumbnail = OC::$CONFIG_DATADIRECTORY.'/../gallery/'.urldecode($albumname).'.png';
+ $view = OCP\App::getStorage('gallery');
+ $thumbnail = $view->fopen(urldecode($albumname).'.png', 'r');
header('Content-Type: '.OC_Image::getMimeTypeForFile($thumbnail));
OCP\Response::sendFile($thumbnail);
}
diff --git a/apps/gallery/ajax/sharing.php b/apps/gallery/ajax/sharing.php
index 1223320120b..304757b9e91 100755
--- a/apps/gallery/ajax/sharing.php
+++ b/apps/gallery/ajax/sharing.php
@@ -80,7 +80,8 @@ function handleGetThumbnail($token, $imgpath) {
function handleGetAlbumThumbnail($token, $albumname)
{
$owner = OC_Gallery_Sharing::getTokenOwner($token);
- $file = OCP\Config::getSystemValue("datadirectory").'/'. $owner .'/gallery/'.$albumname.'.png';
+ $view = OCP\App::getStorage('gallery');
+ $file = $view->fopen($albumname.'.png', 'r');
$image = new OC_Image($file);
if ($image->valid()) {
$image->centerCrop();
@@ -93,7 +94,8 @@ function handleGetAlbumThumbnail($token, $albumname)
function handleGetPhoto($token, $photo) {
$owner = OC_Gallery_Sharing::getTokenOwner($token);
- $file = OCP\Config::getSystemValue( "datadirectory", OC::$SERVERROOT."/data" ).'/'.$owner.'/files'.urldecode($photo);
+ $view = OCP\App::getStorage('files');
+ $file = $view->fopen(urldecode($photo), 'r');
header('Content-Type: '.OC_Image::getMimeTypeForFile($file));
OCP\Response::sendFile($file);
}