Beispiel #1
0
 public function upload_all($photo)
 {
     $basePath = Kohana::config('myshot.basePath');
     $finalPath = $photo->creationYear() . "/" . $photo->creationMonth() . "/";
     Library_Akamai::factory()->addToDir($basePath . $photo->thumbnail, $photo->creationYear(), $photo->creationMonth())->addToDir($basePath . $photo->small, $photo->creationYear(), $photo->creationMonth())->addToDir($basePath . $photo->medium, $photo->creationYear(), $photo->creationMonth())->addToDir($basePath . $photo->large, $photo->creationYear(), $photo->creationMonth())->addToDir($basePath . $photo->original, $photo->creationYear(), $photo->creationMonth());
     //delete photos off of this server
     Helper_Photos::deleteAllLocal($photo);
     //update locations in database
     if (strpos($photo->thumbnail, $finalPath) === false) {
         $photo->thumbnail = $finalPath . $photo->thumbnail;
         $photo->small = $finalPath . $photo->small;
         $photo->medium = $finalPath . $photo->medium;
         $photo->large = $finalPath . $photo->large;
         $photo->original = $finalPath . $photo->original;
         $photo->save();
     }
 }