Can somebody please tell me how to include my domain name in my image path which is dynamically created for my mailings? My email application uses Fckeditor to upload and insert the images but the mailings arrive with relative image paths which do not include my domain name.
This is what the email source looks like for the image location:
<img height="88"
src="/emailer/system/data/user_uploads/1/Image/folder1/company_logo.gif" width="200" alt=""/>
This is how it should be:
<img height="88"
src="http://domain.com/emailer/system/data/user_uploads/1/Image/folder1/company_logo.gif" width="200" alt=""/>
This is the piece of code in the fckeditor config.php file which I believe controls the image path:
session_start();
$Config['UserFilesPath'] = $_SESSION['oemPro']['Settings']['DataRelativePath'].'/user_uploads/'.$_SESSION['oemPro']['Administrator']['AdministratorID'].'/';
I've also found a file which was included in the latest version of my email application which contains the following code to try to fix this problem but that obviously didn't work when it was created ... maybe somebody can see the flaw in it?
// Fixes FCKEditor image source bug
function FixFCKEditorImageSourceBug($Content, $ArrayConfig)
{
preg_match_all("/src\=\"(.*)\/data\/user_uploads(.*)\"/iU", $Content, $ArrayMatches, PREG_SET_ORDER);
foreach ($ArrayMatches as $EachMatch)
{
$TMPImageURL = $EachMatch[1].'/data/user_uploads'.$EachMatch[2];
$TMPCorrectImageURL = $ArrayConfig['URLs']['Software'].$TMPImageURL;
$Content = str_replace('src="'.$TMPImageURL.'"', 'src="'.$TMPCorrectImageURL.'"', $Content);
}
preg_match_all("/src\=\"(.*)\/data\/editors\/fckeditor(.*)\"/iU", $Content, $ArrayMatches, PREG_SET_ORDER);
foreach ($ArrayMatches as $EachMatch)
{
$TMPImageURL = $EachMatch[1].'/data/editors/fckeditor'.$EachMatch[2];
$TMPCorrectImageURL = $ArrayConfig['URLs']['Software'].$TMPImageURL;
$Content = str_replace('src="'.$TMPImageURL.'"', 'src="'.$TMPCorrectImageURL.'"', $Content);
}
return $Content;
}
Any suggestions will be greatly appreciated. Thanks! 🙂