diff options
author | kondou <kondou@ts.unde.re> | 2013-09-01 15:50:58 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2013-09-01 15:50:58 +0200 |
commit | 2d6a400381ffe9d13047ecf7273c550f335e5225 (patch) | |
tree | 4cbd7974c064a3ac6269404bf6afcca911b8d08b | |
parent | 235638e5abd35f2f19944bbe0b5a838b83465252 (diff) | |
download | nextcloud-server-2d6a400381ffe9d13047ecf7273c550f335e5225.tar.gz nextcloud-server-2d6a400381ffe9d13047ecf7273c550f335e5225.zip |
Check for $this->fileInfo and @depend on testData()
-rw-r--r-- | lib/image.php | 4 | ||||
-rw-r--r-- | tests/lib/image.php | 3 |
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()); |