Merge pull request #5827 from owncloud/avoid_preview_errors
Use dedicated OC_Image loader methods in previews
This commit is contained in:
commit
19e03ef77f
5 changed files with 12 additions and 7 deletions
|
@ -21,11 +21,11 @@ class Image extends Provider {
|
|||
return false;
|
||||
}
|
||||
|
||||
$image = new \OC_Image();
|
||||
//check if file is encrypted
|
||||
if($fileInfo['encrypted'] === true) {
|
||||
$image = new \OC_Image(stream_get_contents($fileview->fopen($path, 'r')));
|
||||
$image->loadFromData(stream_get_contents($fileview->fopen($path, 'r')));
|
||||
}else{
|
||||
$image = new \OC_Image();
|
||||
$image->loadFromFile($fileview->getLocalFile($path));
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,8 @@ if (!\OC_Util::runningOnWindows()) {
|
|||
|
||||
shell_exec($cmd);
|
||||
|
||||
$image = new \OC_Image($tmpPath);
|
||||
$image = new \OC_Image();
|
||||
$image->loadFromFile($tmpPath);
|
||||
|
||||
unlink($absPath);
|
||||
unlink($tmpPath);
|
||||
|
|
|
@ -25,7 +25,8 @@ class MP3 extends Provider {
|
|||
if(isset($tags['id3v2']['APIC'][0]['data'])) {
|
||||
$picture = @$tags['id3v2']['APIC'][0]['data'];
|
||||
unlink($tmpPath);
|
||||
$image = new \OC_Image($picture);
|
||||
$image = new \OC_Image();
|
||||
$image->loadFromData($picture);
|
||||
return $image->valid() ? $image : $this->getNoCoverThumbnail();
|
||||
}
|
||||
|
||||
|
@ -39,7 +40,8 @@ class MP3 extends Provider {
|
|||
return false;
|
||||
}
|
||||
|
||||
$image = new \OC_Image($icon);
|
||||
$image = new \OC_Image();
|
||||
$image->loadFromFile($icon);
|
||||
return $image->valid() ? $image : false;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,8 @@ if (!\OC_Util::runningOnWindows()) {
|
|||
return false;
|
||||
}
|
||||
|
||||
$image = new \OC_Image($pdf);
|
||||
$image = new \OC_Image();
|
||||
$image->loadFromData($pdf);
|
||||
|
||||
unlink($absPath);
|
||||
unlink($absPath . '.pdf');
|
||||
|
|
|
@ -80,7 +80,8 @@ class MSOfficeExcel extends Provider {
|
|||
unlink($absPath);
|
||||
unlink($tmpPath);
|
||||
|
||||
$image = new \OC_Image($pdf);
|
||||
$image = new \OC_Image();
|
||||
$image->loadFromData($pdf);
|
||||
|
||||
return $image->valid() ? $image : false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue