summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2013-11-13 00:36:42 +0100
committerThomas Tanghus <thomas@tanghus.net>2013-11-13 00:36:42 +0100
commitec51825d318ebc28069e1bf55fe51105d2ec1a0c (patch)
treec80f86daeec8ebb7532b9daf77dd656fd6022fcc /lib
parentdc30056025f63d32de0846bdf14e971988f83cdb (diff)
downloadnextcloud-server-ec51825d318ebc28069e1bf55fe51105d2ec1a0c.tar.gz
nextcloud-server-ec51825d318ebc28069e1bf55fe51105d2ec1a0c.zip
Use dedicated OC_Image loader methods
This prevents excessive logging and disk access
Diffstat (limited to 'lib')
-rw-r--r--lib/private/preview/image.php4
-rw-r--r--lib/private/preview/movies.php3
-rw-r--r--lib/private/preview/mp3.php6
-rw-r--r--lib/private/preview/office-cl.php3
-rw-r--r--lib/private/preview/office-fallback.php3
5 files changed, 12 insertions, 7 deletions
diff --git a/lib/private/preview/image.php b/lib/private/preview/image.php
index 9aec967282d..84343df2608 100644
--- a/lib/private/preview/image.php
+++ b/lib/private/preview/image.php
@@ -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));
}
diff --git a/lib/private/preview/movies.php b/lib/private/preview/movies.php
index 4d85e23c63c..1802a20711e 100644
--- a/lib/private/preview/movies.php
+++ b/lib/private/preview/movies.php
@@ -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);
diff --git a/lib/private/preview/mp3.php b/lib/private/preview/mp3.php
index 1eed566315c..3fc0ab0490c 100644
--- a/lib/private/preview/mp3.php
+++ b/lib/private/preview/mp3.php
@@ -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;
}
diff --git a/lib/private/preview/office-cl.php b/lib/private/preview/office-cl.php
index 8f2e06c050b..b11fed13ba1 100644
--- a/lib/private/preview/office-cl.php
+++ b/lib/private/preview/office-cl.php
@@ -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');
diff --git a/lib/private/preview/office-fallback.php b/lib/private/preview/office-fallback.php
index e69ab0ab8cb..f184b3149d5 100644
--- a/lib/private/preview/office-fallback.php
+++ b/lib/private/preview/office-fallback.php
@@ -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;
}