Skip to content

Commit

Permalink
Merge pull request #36 from owncloud/exif-rotate-with-encryption
Browse files Browse the repository at this point in the history
Rotate thumbnail when encryption is enabled
  • Loading branch information
DeepDiver1975 committed May 12, 2014
2 parents e0fc8d4 + 9432e88 commit d25d72e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/thumbnail.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,22 @@ public function __construct($imagePath, $user = null, $square = false) {
private function create($imagePath, $square) {
$galleryDir = \OC_User::getHome($this->user) . '/gallery/' . $this->user . '/';
$dir = dirname($imagePath);
if (!$this->view->file_exists($imagePath)) {
return;
$fileInfo = $this->view->getFileInfo($imagePath);
if(!$fileInfo) {
return false;
}
if (!is_dir($galleryDir . $dir)) {
mkdir($galleryDir . $dir, 0755, true);
}
$local = $this->view->getLocalFile($imagePath);

$this->image = new \OCP\Image();
$this->image->loadFromFile($local);
// check if file is encrypted
if($fileInfo['encrypted'] === true) {
$fileName = $this->view->toTmpFile($imagePath);
} else {
$fileName = $this->view->getLocalFile($imagePath);
}
$this->image->loadFromFile($fileName);
if ($this->image->valid()) {
$this->image->fixOrientation();
if ($square) {
Expand Down

0 comments on commit d25d72e

Please sign in to comment.