]> source.dussan.org Git - nextcloud-server.git/commitdiff
OC_Image: Move Content-Type header to show function
authorBart Visscher <bartv@thisnet.nl>
Mon, 13 Feb 2012 21:41:05 +0000 (22:41 +0100)
committerBart Visscher <bartv@thisnet.nl>
Mon, 13 Feb 2012 21:41:05 +0000 (22:41 +0100)
lib/image.php

index 9081a3c7021cf45873fef5156c8d986354c5ea3b..df8f76352a0e8f6ebca573eca5f96dc4e95c943f 100644 (file)
@@ -102,6 +102,7 @@ class OC_Image {
        * @returns bool
        */
        public function show() {
+               header('Content-Type: '.$this->mimeType());
                return $this->_output();
        }
 
@@ -117,17 +118,14 @@ class OC_Image {
                } elseif($filepath === null && $this->filepath !== null) {
                        $filepath = $this->filepath;
                }
-               return $this->_output($filepath, true);
+               return $this->_output($filepath);
        }
 
        /**
        * @brief Outputs/saves the image.
        */
-       private function _output($filepath=null, $really=false) {
-               if($really === false) {
-                       header('Content-Type: '.$this->mimeType());
-                       $filepath = null; // Just being cautious ;-)
-               } else {
+       private function _output($filepath=null) {
+               if($filepath) {
                        if(!is_writable(dirname($filepath))) {
                                OC_Log::write('core',__METHOD__.'(): Directory \''.dirname($filepath).'\' is not writable.', OC_Log::ERROR);
                                return false;