Common\Doctrine\ValueObject\AbstractImage::getWebPath PHP Method

getWebPath() public method

public getWebPath ( string | null $subDirectory = null ) : string | null
$subDirectory string | null
return string | null
    public function getWebPath($subDirectory = null)
    {
        if (self::GENERATE_THUMBNAILS && $subDirectory === null) {
            $subDirectory = 'source';
        }
        $file = $this->getAbsolutePath($subDirectory);
        if (is_file($file) && file_exists($file)) {
            $webPath = FRONTEND_FILES_URL . '/' . $this->getTrimmedUploadDir() . '/';
            if ($subDirectory !== null) {
                $webPath .= $subDirectory . '/';
            }
            return $webPath . $this->fileName;
        }
        return static::FALLBACK_IMAGE;
    }