diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-02-26 14:53:01 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-02-26 14:53:01 +0000 |
commit | 0929d41305e84b621a05f1221ace9c447d378e75 (patch) | |
tree | 004f1751500a5587a84cbd2bed61e8d350975bb6 | |
parent | df7b05b40edf6fef1d6b9a4990dbf35a47bcd372 (diff) |
Added a check to insure that the resize or thumbs image files do not
exists. As per ticket #109
-rw-r--r-- | core/helpers/movie.php | 9 | ||||
-rw-r--r-- | core/helpers/photo.php | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/core/helpers/movie.php b/core/helpers/movie.php index 9a93afbf..78c28908 100644 --- a/core/helpers/movie.php +++ b/core/helpers/movie.php @@ -75,6 +75,13 @@ class movie_Core { // This saves the photo $movie->add_to_parent($parent); + + // If the thumb or resize already exists then rename it + if (file_exists($movie->resize_path()) || file_exists($movie->thumb_path())) { + $movie->name = $pi["filename"] . "-" . rand() . "." . $pi["extension"]; + $movie->save(); + } + copy($filename, $movie->file_path()); module::event("item_created", $movie); @@ -83,7 +90,7 @@ class movie_Core { graphics::generate($movie); // If the parent has no cover item, make this it. - $parent = $movie->parent(); + //$parent = $movie->parent(); if ($parent->album_cover_item_id == null) { $parent->album_cover_item_id = $movie->id; $parent->save(); diff --git a/core/helpers/photo.php b/core/helpers/photo.php index aab72a87..7664e2d0 100644 --- a/core/helpers/photo.php +++ b/core/helpers/photo.php @@ -72,9 +72,15 @@ class photo_Core { // @todo Improve this. Random numbers are not user friendly $photo->name = rand() . "." . $pi["extension"]; } - // This saves the photo $photo->add_to_parent($parent); + + // If the thumb or resize already exists then rename it + if (file_exists($photo->resize_path()) || file_exists($photo->thumb_path())) { + $photo->name = $pi["filename"] . "-" . rand() . "." . $pi["extension"]; + $photo->save(); + } + copy($filename, $photo->file_path()); module::event("item_created", $photo); |