]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #141 forcing the creation of album directory in user directories for group...
authorCash Costello <cash.costello@gmail.com>
Sun, 5 Jun 2011 16:58:09 +0000 (16:58 +0000)
committerCash Costello <cash.costello@gmail.com>
Sun, 5 Jun 2011 16:58:09 +0000 (16:58 +0000)
actions/upload.php
lib/image.php

index c0496da966b513c3a4ac36f66add06d858d54da4..3bbd97e600db715890e820c84b10d664db106860 100644 (file)
@@ -105,11 +105,11 @@ foreach($_FILES as $key => $sent_file) {
                continue;
        }
 
-       //this will save to users folder in /image/ and organize by photo album
+       //this will save to user's folder in /image/ and organize by photo album
        $file = new TidypicsImage();
        $file->container_guid = $album_guid;
        $file->setMimeType($mime);
-       $file->simpletype="image";
+       $file->simpletype = "image";
        $file->access_id = $access_id;
        //$file->title = substr($name, 0, strrpos($name, '.'));
 
index 7f98a08d7fc9e7e48b9f21bcbdf594fd19ce4e76..14ac2e68827aed61784e10f2b4756191316bc8da 100644 (file)
@@ -60,6 +60,13 @@ class TidypicsImage extends ElggFile {
         */
        public function saveImageFile($uploadedFilename, $size) {
 
+               // we need to make sure the directory for the album exists
+               // @note for group albums, the photos are distributed among the users
+               $dir = tp_get_img_dir() . $this->getContainer();
+               if (!file_exists($dir)) {
+                       mkdir($dir, 0755, true);
+               }
+
                $filename = $this->getFilenameOnFilestore();
 
                $result = move_uploaded_file($uploadedFilename, $filename);