def get_relative_image_path(self, path):
        """
        Get a path relative to images directory path
        or an abspath if the path is not located inside
        image directory

        :param path: file path
        :return: file path
        """

        if not path:
            return ""
        path = force_unix_path(self.get_abs_image_path(path))

        img_directory = self.get_images_directory()

        for directory in images_directories(self._NODE_TYPE):
            if os.path.commonprefix([directory, path]) == directory:
                relpath = os.path.relpath(path, directory)
                # We don't allow to recurse search from the top image directory just for image type directory (compatibility with old releases)
                if os.sep not in relpath or directory == img_directory:
                    return relpath
        return path
Get a path relative to images directory path
        or an abspath if the path is not located inside
        image directory

        :param path: file path
        :return: file path