Skip to content

How to get vendor_module/view/frontend/web/images path within Setup/Patch script?

I need to get the url of the image located in the module.

I need to run a Patch script because I am updating a cms block with an additional image.

The image path I am getting is localhost/pub/static/version1655667432/frontend/_view/en_US…

But when I look at the pub folder, the path should be
localhost/pub/static/version1655667432/frontend/default/en_US…

    try {
        $this->_appState->setAreaCode(MagentoFrameworkAppArea::AREA_FRONTEND);

    } catch (Exception $e) {
        $this->_appState->getAreaCode();
    }

    $params = array('_secure' => $this->request->isSecure());
    $madeInUsaImgPath = $this->assetRepo->getUrlWithParams('Collins_ShowOnAll::images/made-in-usa.png', $params);