Skip to content

Commit

Permalink
Merge pull request #153 from wonknu/bug_111
Browse files Browse the repository at this point in the history
fix: img url on pages use "\" instead of "/" fixes #111 & fixes #152
  • Loading branch information
gregorybesson committed Mar 3, 2017
2 parents 0ba90e6 + 330832f commit 636db0d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cli/cms/media/image.js
Expand Up @@ -103,8 +103,8 @@ export function saveFile(req) {
folderWebPath = '/' + config.upload[mediaType]
}

filePath = path.join(folderFilePath, slug)
resp['filePath'] = path.join('/' + folderWebPath, slug)
filePath = path.posix.join(folderFilePath, slug)
resp['filePath'] = path.posix.join('/' + folderWebPath, slug)

file.on('limit', function() {
hasSentHeader = true
Expand All @@ -130,10 +130,15 @@ export function saveFile(req) {
if(mediaType === 'image') {
var thumbPromise = generateThumbnail(filePath)
thumbPromise.then(function (thumbResp) {
resp.thumbnail = thumbResp.thumb
resp.thumbnail = (/^win/.test(process.platform)) ? thumbResp.thumb.replace(/\\/g, '/') : thumbResp.thumb;
if(req.query.input.indexOf('data-size') > -1){
var thumbsSizes = cmsData.regex.getAttr(req.query.input, 'data-size').split(',')
cropAndSaveFiles(thumbsSizes, filePath, resp).then(function (resp) {
if(/^win/.test(process.platform)){
for (var i = 0; i < resp.thumbs.length; i++) {
resp.thumbs[i].name = resp.thumbs[i].name.replace(/\\/g, '/')
}
}
resolve(resp)
})
}
Expand Down

0 comments on commit 636db0d

Please sign in to comment.