]> git.mxchange.org Git - friendica.git/blobdiff - mod/photo.php
Merge pull request #927 from annando/master
[friendica.git] / 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