Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for space in image name and wordpress image not shown in email #34

Merged
merged 1 commit into from
Aug 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Mosaico/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ static function processDl()

$static_file_name = $method . "_" . $width . "x" . $height . "_" . $file_name;

$html = str_ireplace( $matches[ 1 ][ $i ], $config['BASE_URL'] . $config['STATIC_URL'] . urlencode( $static_file_name ), $html );
$html = str_ireplace( $matches[ 1 ][ $i ], $config['BASE_URL'] . $config['STATIC_URL'] . rawurlencode( $static_file_name ), $html );//Changed to rawurlencode because space gets into + in the image file name if it has space

$image = self::resizeImage( $file_name, $method, $width, $height );

Expand Down
6 changes: 5 additions & 1 deletion js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ $(function() {
return;
}
var cmsPath = window.location.href.substr(0, window.location.href.lastIndexOf('/'));
var imageUrl = cmsPath;
if (cmsPath.indexOf('wp-admin/admin.php') !== -1) {//Fix me CRM.url
imageUrl = cmsPath.replace('wp-admin/admin.php','');//In order to stop image urls get admin in there which causes images not being displayed in email for wordpress
}
var plugins;
// A basic plugin that expose the "viewModel" object as a global variable.
// plugins = [function(vm) {window.viewModel = vm;}];
var ok = Mosaico.init({
imgProcessorBackend: cmsPath+'/img',
imgProcessorBackend: imageUrl+'/img',
emailProcessorBackend: cmsPath+'/dl',
titleToken: "MOSAICO Responsive Email Designer",
fileuploadConfig: {
Expand Down
2 changes: 1 addition & 1 deletion packages/mosaico/backend-php/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function ProcessDlRequest()

$static_file_name = $method . "_" . $width . "x" . $height . "_" . $file_name;

$html = str_ireplace( $matches[ 1 ][ $i ], $config[ BASE_URL ] . $config[ STATIC_URL ] . urlencode( $static_file_name ), $html );
$html = str_ireplace( $matches[ 1 ][ $i ], $config[ BASE_URL ] . $config[ STATIC_URL ] . rawurlencode( $static_file_name ), $html );//Changed to rawurlencode because space gets into + in image file name if it has space

$image = ResizeImage( $file_name, $method, $width, $height );

Expand Down