public function deleteAction()
 {
     if ($this->_getParam("type") == "childs") {
         $parentAsset = Asset::getById($this->_getParam("id"));
         $list = new Asset_List();
         $list->setCondition("path LIKE '" . $parentAsset->getFullPath() . "/%'");
         $list->setLimit(intval($this->_getParam("amount")));
         $list->setOrderKey("LENGTH(path)", false);
         $list->setOrder("DESC");
         $assets = $list->load();
         $deletedItems = array();
         foreach ($assets as $asset) {
             $deletedItems[] = $asset->getFullPath();
             $asset->delete();
         }
         $this->_helper->json(array("success" => true, "deleted" => $deletedItems));
     } else {
         if ($this->_getParam("id")) {
             $asset = Asset::getById($this->_getParam("id"));
             if ($asset->isAllowed("delete")) {
                 $asset->delete();
                 $this->_helper->json(array("success" => true));
             }
         }
     }
     $this->_helper->json(array("success" => false, "message" => "missing_permission"));
 }
    $allowedThumbs = explode(",", $opts->getOption("thumbnails"));
}
// get only images
$conditions = array("type = 'image'");
if ($opts->getOption("parent")) {
    $parent = Asset::getById($opts->getOption("parent"));
    if ($parent instanceof Asset_Folder) {
        $conditions[] = "path LIKE '" . $parent->getFullPath() . "/%'";
    } else {
        echo $opts->getOption("parent") . " is not a valid asset folder ID!\n";
        exit;
    }
}
$list = new Asset_List();
$list->setCondition(implode(" AND ", $conditions));
$total = $list->getTotalCount();
$perLoop = 10;
for ($i = 0; $i < ceil($total / $perLoop); $i++) {
    $list->setLimit($perLoop);
    $list->setOffset($i * $perLoop);
    $images = $list->load();
    foreach ($images as $image) {
        foreach ($thumbnails as $thumbnail) {
            if (empty($allowedThumbs) || in_array($thumbnail, $allowedThumbs)) {
                echo "generating thumbnail for image: " . $image->getFullpath() . " | " . $image->getId() . " | Thumbnail: " . $thumbnail . " : " . formatBytes(memory_get_usage()) . " \n";
                $image->getThumbnail($thumbnail);
            }
        }
    }
    Pimcore::collectGarbage();
}