handle encrypted images files in oc_image

This commit is contained in:
Bartek Przybylski 2012-06-09 15:22:02 +02:00
parent 531132d64f
commit 120997112c
1 changed files with 7 additions and 4 deletions

View File

@ -407,11 +407,14 @@ class OC_Image {
break;
*/
default:
error_log($imagepath);
error_log(\OC_Filesystem::getInternalPath($imagepath));
error_log(\OC_Filesystem::getLocalFile($imagepath));
// this is mostly file created from encrypted file
$this->resource = imagecreatefromstring(\OC_Filesystem::file_get_contents(\OC_Filesystem::getInternalPath($imagepath)));
$datadir = \OCP\Config::getSystemValue('datadirectory').'/'.\OC_User::getUser().'/files';
$newimgpath = $imagepath;
if (strncmp($newimgpath, $datadir, strlen($datadir)) == 0) {
$newimgpath = substr($imagepath, strlen($datadir));
}
$this->resource = imagecreatefromstring(\OC_Filesystem::file_get_contents($newimgpath));
$itype = IMAGETYPE_PNG;
OC_Log::write('core','OC_Image->loadFromFile, Default', OC_Log::DEBUG);
break;