String getVFSName(CmsObject cms, String oName) {

        oName = CmsStringUtil.substitute(oName, "\\", "/");
        if (!oName.startsWith("/")) {
            oName = "/" + oName;
        }

        if (PATH_TO_VFS_NAME.containsKey(oName)) {
            return PATH_TO_VFS_NAME.get(oName);
        }

        String imgName = oName;
        CmsResource res = null;
        boolean found = false;
        while (!found) {
            String path = CmsResource.getParentFolder(imgName);
            String name = imgName.substring(path.length());
            String ext = CmsFileUtil.getExtension(imgName);
            String nameWoExt = name.substring(0, name.length() - ext.length());
            int pos = nameWoExt.lastIndexOf("_");
            String newName = path;
            found = (pos < 0);
            if (!found) {
                newName += nameWoExt.substring(0, pos);
            } else {
                newName += nameWoExt;
            }
            newName += ext;
            try {
                res = cms.readResource(newName, CmsResourceFilter.ALL);
                found = true;
            } catch (Exception e) {
                // it could be a variation
            }
            imgName = newName;
        }

        if (res != null) {
            PATH_TO_VFS_NAME.put(oName, res.getRootPath());
            return res.getRootPath();
        }
        return "";
    }
String getVFSName ( CmsObject cms , String oName ) { oName = CmsStringUtil . substitute ( oName , "\\" , "/" ) ; if ( ! oName . startsWith ( "/" ) ) { oName = "/" + oName ; } if ( PATH_TO_VFS_NAME . containsKey ( oName ) ) { return PATH_TO_VFS_NAME . get ( oName ) ; } String imgName = oName ; CmsResource res = null ; boolean found = false ; while ( ! found ) { String path = CmsResource . getParentFolder ( imgName ) ; String name = imgName . substring ( path . length ( ) ) ; String ext = CmsFileUtil . getExtension ( imgName ) ; String nameWoExt = name . substring ( 0 , name . length ( ) - ext . length ( ) ) ; int pos = nameWoExt . lastIndexOf ( "_" ) ; String newName = path ; found = ( pos < 0 ) ; if ( ! found ) { newName += nameWoExt . substring ( 0 , pos ) ; } else { newName += nameWoExt ; } newName += ext ; try { res = cms . readResource ( newName , CmsResourceFilter . ALL ) ; found = true ; } catch ( Exception e ) { } imgName = newName ; } if ( res != null ) { PATH_TO_VFS_NAME . put ( oName , res . getRootPath ( ) ) ; return res . getRootPath ( ) ; } return "" ; }
Get name of image in the VFS.<p>

@param cms CmsObject
@param oName Name of cached image file
@return vfs resource name (root path)