Example #1
0
 public function welcome()
 {
     if (Auth::check()) {
         // If logged-in, sent to sprite listing
         return redirect("/home");
     }
     $sprites = Sprite::all()->count();
     return view("welcome", ["sprites" => $sprites]);
 }
Example #2
0
 public function redoColors()
 {
     $sprites = Sprite::all();
     foreach ($sprites as $sprite) {
         $path = public_path() . "/sprites/full/" . $sprite->alphaid . ".png";
         $image = Image::make($path);
         $palette = new \BrianMcdo\ImagePalette\ImagePalette($path, 3);
         $colors = "";
         foreach ($palette as $color) {
             $colors .= $color . " ";
         }
         $sprite->colors = $colors;
         $sprite->save();
     }
 }