public function deleteArticleMasterPicture($oObject, $iIndex, $blDeleteMasterPicture = true)
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $myUtilsPic = \OxidEsales\Eshop\Core\Registry::getUtilsPic();
        $oUtilsFile = \OxidEsales\Eshop\Core\Registry::getUtilsFile();
        $blGeneratedImagesOnly = !$blDeleteMasterPicture;

        $sAbsDynImageDir = $myConfig->getPictureDir(false);
        $sMasterImage = basename($oObject->{"oxarticles__oxpic" . $iIndex}->value);
        if (!$sMasterImage || $sMasterImage == "nopic.jpg") {
            return;
        }

        $aPic = ["sField"    => "oxpic" . $iIndex,
                      "sDir"      => $oUtilsFile->getImageDirByType("M" . $iIndex, $blGeneratedImagesOnly),
                      "sFileName" => $sMasterImage];

        $blDeleted = $myUtilsPic->safePictureDelete($aPic["sFileName"], $sAbsDynImageDir . $aPic["sDir"], "oxarticles", $aPic["sField"]);
        if ($blDeleted) {
            $this->deleteZoomPicture($oObject, $iIndex);

            $aDelPics = [];
            if ($iIndex == 1) {
                // deleting generated main icon picture if custom main icon
                // file name not equal with generated from master picture
                if ($this->getMainIconName($sMasterImage) != basename($oObject->oxarticles__oxicon->value)) {
                    $aDelPics[] = ["sField"    => "oxpic1",
                                        "sDir"      => $oUtilsFile->getImageDirByType("ICO", $blGeneratedImagesOnly),
                                        "sFileName" => $this->getMainIconName($sMasterImage)];
                }

                // deleting generated thumbnail picture if custom thumbnail
                // file name not equal with generated from master picture
                if ($this->getThumbName($sMasterImage) != basename($oObject->oxarticles__oxthumb->value)) {
                    $aDelPics[] = ["sField"    => "oxpic1",
                                        "sDir"      => $oUtilsFile->getImageDirByType("TH", $blGeneratedImagesOnly),
                                        "sFileName" => $this->getThumbName($sMasterImage)];
                }
            }

            foreach ($aDelPics as $aPic) {
                $myUtilsPic->safePictureDelete($aPic["sFileName"], $sAbsDynImageDir . $aPic["sDir"], "oxarticles", $aPic["sField"]);
            }
        }

        //deleting custom zoom pic (compatibility mode)
        if ($oObject->{"oxarticles__oxzoom" . $iIndex}->value) {
            if (basename($oObject->{"oxarticles__oxzoom" . $iIndex}->value) !== "nopic.jpg") {
                // deleting old zoom picture
                $this->deleteZoomPicture($oObject, $iIndex);
            }
        }
    }