aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/upload.php4
-rw-r--r--lib/image.php7
2 files changed, 9 insertions, 2 deletions
diff --git a/actions/upload.php b/actions/upload.php
index c0496da96..3bbd97e60 100644
--- a/actions/upload.php
+++ b/actions/upload.php
@@ -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, '.'));
diff --git a/lib/image.php b/lib/image.php
index 7f98a08d7..14ac2e688 100644
--- a/lib/image.php
+++ b/lib/image.php
@@ -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);