src/Application.php
private function formImagePath($imagePath, $imageSrc)
    {
        // Get old-way image path, remove full path to check file
        if (empty($imagePath)) {
            $path = $imageSrc;
        } else { // Use new CORRECT way
            $path = $imagePath . $imageSrc;
        }

        // form relative path to the image
        $dir = quotemeta(__SAMSON_BASE__);
        // TODO: WTF? Why do we need this, need comments!!!
        if (strpos($path, 'http://') === false) {
            if ($dir == '/') {
                return substr($path, 1);
            } else {
                return preg_replace('/' . addcslashes($dir, '/') . '/', '', $path);
            }
        }

        return $path;
    }
private function formImagePath($imagePath, $imageSrc)
    {
        // Get old-way image path, remove full path to check file
        if (empty($imagePath)) {
            $path = $imageSrc;
        } else { // Use new CORRECT way
            $path = $imagePath . $imageSrc;
        }

        // form relative path to the image
        $dir = quotemeta(__SAMSON_BASE__);
        // TODO: WTF? Why do we need this, need comments!!!
        if (strpos($path, 'http://') === false) {
            if ($dir == '/') {
                return substr($path, 1);
            } else {
                return preg_replace('/' . addcslashes($dir, '/') . '/', '', $path);
            }
        }

        return $path;
    }
private function formImagePath ( $ imagePath , $ imageSrc ) { // Get old-way image path, remove full path to check file if ( empty ( $ imagePath ) ) { $ path = $ imageSrc ; } else { // Use new CORRECT way $ path = $ imagePath . $ imageSrc ; } // form relative path to the image $ dir = quotemeta ( __SAMSON_BASE__ ) ; // TODO: WTF? Why do we need this, need comments!!! if ( strpos ( $ path , 'http://' ) === false ) { if ( $ dir == '/' ) { return substr ( $ path , 1 ) ; } else { return preg_replace ( '/' . addcslashes ( $ dir , '/' ) . '/' , '' , $ path ) ; } } return $ path ; }
Function to form image path correctly, also supports old database structure
@param string $imagePath Path to the image
@param string $imageSrc Image name
@return string Full path to image
Function to form image path correctly also supports old database structure