public function performAction(ElementQueryInterface $query): bool
    {

        $imagesToPurge = $query->kind('image')->all();

        if (empty($imagesToPurge)) {
            $this->setMessage(Craft::t('imager', 'No images to purge'));
            return true;
        }

        /** @var Imager $imagerPlugin */
        $imagerPlugin = Plugin::$plugin;

        try {
            foreach ($imagesToPurge as $imageToPurge) {
                $imagerPlugin->imgix->purgeAssetFromImgix($imageToPurge);
            }
        } catch (\Throwable $e) {
            $this->setMessage($e->getMessage());
            return false;
        }

        $numImagesToPurge = \count($imagesToPurge);
        if ($numImagesToPurge > 1) {
            $this->setMessage(Craft::t('imager', 'Purging {count} images from Imgix...', [
                'count' => $numImagesToPurge,
            ]));
            return true;
        }

        $this->setMessage(Craft::t('imager', 'Purging image from Imgix...'));
        return true;
    }
public function performAction(ElementQueryInterface $query): bool
    {

        $imagesToPurge = $query->kind('image')->all();

        if (empty($imagesToPurge)) {
            $this->setMessage(Craft::t('imager', 'No images to purge'));
            return true;
        }

        /** @var Imager $imagerPlugin */
        $imagerPlugin = Plugin::$plugin;

        try {
            foreach ($imagesToPurge as $imageToPurge) {
                $imagerPlugin->imgix->purgeAssetFromImgix($imageToPurge);
            }
        } catch (\Throwable $e) {
            $this->setMessage($e->getMessage());
            return false;
        }

        $numImagesToPurge = \count($imagesToPurge);
        if ($numImagesToPurge > 1) {
            $this->setMessage(Craft::t('imager', 'Purging {count} images from Imgix...', [
                'count' => $numImagesToPurge,
            ]));
            return true;
        }

        $this->setMessage(Craft::t('imager', 'Purging image from Imgix...'));
        return true;
    }
public function performAction ( ElementQueryInterface $ query ) : bool { $ imagesToPurge = $ query -> kind ( 'image' ) -> all ( ) ; if ( empty ( $ imagesToPurge ) ) { $ this -> setMessage ( Craft :: t ( 'imager' , 'No images to purge' ) ) ; return true ; } /** @var Imager $imagerPlugin */ $ imagerPlugin = Plugin :: $ plugin ; try { foreach ( $ imagesToPurge as $ imageToPurge ) { $ imagerPlugin -> imgix -> purgeAssetFromImgix ( $ imageToPurge ) ; } } catch ( \ Throwable $ e ) { $ this -> setMessage ( $ e -> getMessage ( ) ) ; return false ; } $ numImagesToPurge = \ count ( $ imagesToPurge ) ; if ( $ numImagesToPurge > 1 ) { $ this -> setMessage ( Craft :: t ( 'imager' , 'Purging {count} images from Imgix...' , [ 'count' => $ numImagesToPurge , ] ) ) ; return true ; } $ this -> setMessage ( Craft :: t ( 'imager' , 'Purging image from Imgix...' ) ) ; return true ; }
Purges selected image Assets from Imgix

@param ElementQueryInterface $query

@return bool
Purges selected image Assets from Imgix