forked from Wavyzz/dolibarr
Merge
This commit is contained in:
@@ -264,12 +264,23 @@ class CMailFile
|
||||
// This convert an embedd file with src="/viewimage.php?modulepart... into a cid link
|
||||
// TODO Exclude viewimage used for the read tracker ?
|
||||
$findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias');
|
||||
if ($findimg<0) {
|
||||
dol_syslog("CMailFile::CMailfile: Error on findHtmlImages");
|
||||
$this->error = 'ErrorInAddAttachementsImageBaseOnMedia';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA)) {
|
||||
// Search into the body for <img src="data:image/ext;base64,..." to replace them with an embedded file
|
||||
// This convert an embedded file with src="data:image... into a cid link + attached file
|
||||
$findimg = $this->findHtmlImagesIsSrcData($upload_dir_tmp);
|
||||
$resultImageData = $this->findHtmlImagesIsSrcData($upload_dir_tmp);
|
||||
if ($resultImageData<0) {
|
||||
dol_syslog("CMailFile::CMailfile: Error on findHtmlImagesInSrcData");
|
||||
$this->error = 'ErrorInAddAttachementsImageBaseOnMedia';
|
||||
return;
|
||||
}
|
||||
$findimg += $resultImageData;
|
||||
}
|
||||
|
||||
// Set atleastoneimage if there is at least one embedded file (into ->html_images)
|
||||
@@ -1892,7 +1903,7 @@ class CMailFile
|
||||
|
||||
// We search (into mail body this->html), if we find some strings like "... file=xxx.img"
|
||||
// For example when:
|
||||
// <img alt="" src="/viewimage.php?modulepart=medias&entity=1&file=image/picture.jpg" style="height:356px; width:1040px" />
|
||||
// <img alt="" src="/src="data:image....;base64,...." />
|
||||
$matches = array();
|
||||
preg_match_all('/src="data:image\/('.implode('|', $extensions).');base64,([^"]+)"/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found
|
||||
|
||||
@@ -1903,7 +1914,7 @@ class CMailFile
|
||||
return -1;
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$i = count($this->html_images);
|
||||
foreach ($matches[1] as $key => $ext) {
|
||||
// We save the image to send in disk
|
||||
$filecontent = $matches[2][$key];
|
||||
|
||||
Reference in New Issue
Block a user