summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/image.php4
-rw-r--r--tests/lib/image.php3
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/image.php b/lib/image.php
index badc30ab9a0..7761a3c7737 100644
--- a/lib/image.php
+++ b/lib/image.php
@@ -519,7 +519,7 @@ class OC_Image {
return false;
}
$this->resource = @imagecreatefromstring($str);
- if (\OC_Util::fileInfoLoaded()) {
+ if ($this->fileInfo) {
$this->mimeType = $this->fileInfo->buffer($str);
}
if(is_resource($this->resource)) {
@@ -546,7 +546,7 @@ class OC_Image {
$data = base64_decode($str);
if($data) { // try to load from string data
$this->resource = @imagecreatefromstring($data);
- if (\OC_Util::fileInfoLoaded()) {
+ if ($this->fileInfo) {
$this->mimeType = $this->fileInfo->buffer($data);
}
if(!$this->resource) {
diff --git a/tests/lib/image.php b/tests/lib/image.php
index b3db89cf5b8..4aba1b0bc61 100644
--- a/tests/lib/image.php
+++ b/tests/lib/image.php
@@ -135,6 +135,9 @@ class Test_Image extends PHPUnit_Framework_TestCase {
$this->assertEquals($expected, $img->data());
}
+ /**
+ * @depends testData
+ */
public function testToString() {
$img = new \OC_Image(OC::$SERVERROOT.'/tests/data/testimage.png');
$expected = base64_encode($img->data());