mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-25 05:52:16 +00:00
changed conversions to work with new image magick feature pdf:fit-page=
This commit is contained in:
parent
e8b245e857
commit
41b32deac3
1 changed files with 7 additions and 13 deletions
|
@ -20,7 +20,9 @@ module.exports =
|
||||||
if !_.include approvedFormats, requestedFormat
|
if !_.include approvedFormats, requestedFormat
|
||||||
err = new Error("invalid format requested")
|
err = new Error("invalid format requested")
|
||||||
return callback err
|
return callback err
|
||||||
args = "nice convert -flatten -density 300 #{sourcePath} #{destPath}"
|
width = "600x"
|
||||||
|
args = "nice convert -define pdf:fit-page=#{width} -flatten -density 300 #{sourcePath} #{destPath}"
|
||||||
|
console.log args
|
||||||
exec args, childProcessOpts, (err, stdout, stderr)->
|
exec args, childProcessOpts, (err, stdout, stderr)->
|
||||||
timer.done()
|
timer.done()
|
||||||
if err?
|
if err?
|
||||||
|
@ -33,12 +35,8 @@ module.exports =
|
||||||
logger.log sourcePath:sourcePath, "thumbnail convert file"
|
logger.log sourcePath:sourcePath, "thumbnail convert file"
|
||||||
destPath = "#{sourcePath}.png"
|
destPath = "#{sourcePath}.png"
|
||||||
sourcePath = "#{sourcePath}[0]"
|
sourcePath = "#{sourcePath}[0]"
|
||||||
args =
|
width = "260x"
|
||||||
src: sourcePath
|
args = "nice convert -flatten -background white -density 300 -define pdf:fit-page=#{width} #{sourcePath} -resize #{width} #{destPath}"
|
||||||
dst: destPath
|
|
||||||
width: 424
|
|
||||||
height: 300
|
|
||||||
args = "nice convert -flatten -background white -resize 260x -density 300 #{sourcePath} #{destPath}"
|
|
||||||
exec args, childProcessOpts, (err, stdout, stderr)->
|
exec args, childProcessOpts, (err, stdout, stderr)->
|
||||||
if err?
|
if err?
|
||||||
logger.err err:err, stderr:stderr, sourcePath:sourcePath, "something went wrong converting file to preview"
|
logger.err err:err, stderr:stderr, sourcePath:sourcePath, "something went wrong converting file to preview"
|
||||||
|
@ -50,12 +48,8 @@ module.exports =
|
||||||
logger.log sourcePath:sourcePath, "preview convert file"
|
logger.log sourcePath:sourcePath, "preview convert file"
|
||||||
destPath = "#{sourcePath}.png"
|
destPath = "#{sourcePath}.png"
|
||||||
sourcePath = "#{sourcePath}[0]"
|
sourcePath = "#{sourcePath}[0]"
|
||||||
args =
|
width = "548x"
|
||||||
src: sourcePath
|
args = "nice convert -flatten -background white -density 300 -define pdf:fit-page=#{width} #{sourcePath} -resize #{width} #{destPath}"
|
||||||
dst: destPath
|
|
||||||
width: 600
|
|
||||||
height: 849
|
|
||||||
args = "nice convert -flatten -background white -resize 548x -density 300 #{sourcePath} #{destPath}"
|
|
||||||
exec args, childProcessOpts, (err, stdout, stderr)->
|
exec args, childProcessOpts, (err, stdout, stderr)->
|
||||||
if err?
|
if err?
|
||||||
logger.err err:err, stderr:stderr, sourcePath:sourcePath, destPath:destPath, "something went wrong converting file to preview"
|
logger.err err:err, stderr:stderr, sourcePath:sourcePath, destPath:destPath, "something went wrong converting file to preview"
|
||||||
|
|
Loading…
Reference in a new issue