where("typ", "=", "gallery")->get(); foreach ($themesModel as $tm) { $themeList[$tm->name] = $tm; } $sql = 'SELECT images.id, images.path, images.driver, tenants.template, tenants.gallery_default_theme FROM images LEFT JOIN tenants ON tenants.id = images.tenant WHERE typ != "watermark" AND servername = "'.env("APP_SERVER").'";'; $res = DB::select($sql); foreach ($res as $re) { $this->info("Image: ".$re->id); $theme = $themeList[$re->gallery_default_theme]; if(is_null($theme)) { $this->info("Error Theme not found: ".$re->template); exit(); continue; } if($theme->img_pixel) { $image->getImageById($re->id, PublicController::$size["pixel"]); } if($theme->img_small) { $image->getImageById($re->id, PublicController::$size["small"]); } if($theme->img_medium) { $image->getImageById($re->id, PublicController::$size["medium"]); } if($theme->img_big) { $image->getImageById($re->id, PublicController::$size["big"]); } } $list = \Illuminate\Support\Facades\Storage::disk("cache")->allFiles(""); foreach($list as $l) { if(preg_match("@^\d*_orginal_@", $l)) { \Illuminate\Support\Facades\Storage::disk("cache")->delete($l); //$this->info("To Delete: ".$l); } } } }