]> git.mxchange.org Git - friendica.git/commitdiff
Auto creation of photo directory to improve caching
authorMichael Vogel <icarus@dabo.de>
Sun, 16 Mar 2014 16:49:56 +0000 (17:49 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 16 Mar 2014 16:49:56 +0000 (17:49 +0100)
mod/photo.php

index 497dcd750660ea43722e8b43a8fa3c4e430d9cef..434193f71318edc6b9b63abac8feefb8d95a6b4c 100644 (file)
@@ -206,9 +206,15 @@ function photo_init(&$a) {
        echo $data;
 
        // If the photo is public and there is an existing photo directory store the photo there
-       if ($public and ($file != ""))
+       if ($public and ($file != "")) {
+               // If the photo path isn't there, try to create it
+               if (!is_dir($_SERVER["DOCUMENT_ROOT"]."/photo"))
+                       if (is_writable($_SERVER["DOCUMENT_ROOT"]))
+                               mkdir($_SERVER["DOCUMENT_ROOT"]."/photo");
+
                if (is_dir($_SERVER["DOCUMENT_ROOT"]."/photo"))
                        file_put_contents($_SERVER["DOCUMENT_ROOT"]."/photo/".$file, $data);
+       }
 
        killme();
        // NOTREACHED