Services/AzineTemplateProvider.php
public function makeImagePathsWebRelative(array $emailVars, $locale)
    {
        foreach ($emailVars as $key => $value) {
            if (is_string($value) && is_file($value)) {
                // check if the file is in an allowed_images_folder
                $folderKey = $this->isFileAllowed($value);
                if (false !== $folderKey) {
                    // replace the fs-path with the web-path
                    $fsPathToReplace = $this->getFolderFrom($folderKey);
                    $filename = substr($value, strlen($fsPathToReplace));
                    $newValue = $this->getRouter()->generate('azine_email_serve_template_image', array('folderKey' => $folderKey, 'filename' => urlencode($filename), '_locale' => $locale));
                    $emailVars[$key] = $newValue;
                }
            } elseif (is_array($value)) {
                $emailVars[$key] = $this->makeImagePathsWebRelative($value, $locale);
            }
        }

        return $emailVars;
    }
public function makeImagePathsWebRelative(array $emailVars, $locale)
    {
        foreach ($emailVars as $key => $value) {
            if (is_string($value) && is_file($value)) {
                // check if the file is in an allowed_images_folder
                $folderKey = $this->isFileAllowed($value);
                if (false !== $folderKey) {
                    // replace the fs-path with the web-path
                    $fsPathToReplace = $this->getFolderFrom($folderKey);
                    $filename = substr($value, strlen($fsPathToReplace));
                    $newValue = $this->getRouter()->generate('azine_email_serve_template_image', array('folderKey' => $folderKey, 'filename' => urlencode($filename), '_locale' => $locale));
                    $emailVars[$key] = $newValue;
                }
            } elseif (is_array($value)) {
                $emailVars[$key] = $this->makeImagePathsWebRelative($value, $locale);
            }
        }

        return $emailVars;
    }
public function makeImagePathsWebRelative ( array $ emailVars , $ locale ) { foreach ( $ emailVars as $ key => $ value ) { if ( is_string ( $ value ) && is_file ( $ value ) ) { // check if the file is in an allowed_images_folder $ folderKey = $ this -> isFileAllowed ( $ value ) ; if ( false !== $ folderKey ) { // replace the fs-path with the web-path $ fsPathToReplace = $ this -> getFolderFrom ( $ folderKey ) ; $ filename = substr ( $ value , strlen ( $ fsPathToReplace ) ) ; $ newValue = $ this -> getRouter ( ) -> generate ( 'azine_email_serve_template_image' , array ( 'folderKey' => $ folderKey , 'filename' => urlencode ( $ filename ) , '_locale' => $ locale ) ) ; $ emailVars [ $ key ] = $ newValue ; } } elseif ( is_array ( $ value ) ) { $ emailVars [ $ key ] = $ this -> makeImagePathsWebRelative ( $ value , $ locale ) ; } } return $ emailVars ; }
Recursively replace all absolute image-file-paths with relative web-paths.

@param array  $emailVars
@param string $locale

@return array
Recursively replace all absolute image - file - paths with relative web - paths .