]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check for $this->fileInfo and @depend on testData()
authorkondou <kondou@ts.unde.re>
Sun, 1 Sep 2013 13:50:58 +0000 (15:50 +0200)
committerkondou <kondou@ts.unde.re>
Sun, 1 Sep 2013 13:50:58 +0000 (15:50 +0200)
lib/image.php
tests/lib/image.php

index badc30ab9a04a19f90e710ab7ea4f0653204586f..7761a3c7737f3f80722c8f8cb62b0720d4b9c235 100644 (file)
@@ -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) {
index b3db89cf5b8d663279471f59ec3f43e768f65681..4aba1b0bc61e56fd46eb7dfaebac55273aed2a34 100644 (file)
@@ -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());