issue_31527.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. --- services/filestore/app/js/FileConverter.js
  2. +++ services/filestore/app/js/FileConverter.js
  3. @@ -21,49 +21,44 @@
  4. }
  5. async function convert(sourcePath, requestedFormat) {
  6. - const width = '600x'
  7. + const width = 1500
  8. return await _convert(sourcePath, requestedFormat, [
  9. - 'convert',
  10. - '-define',
  11. - `pdf:fit-page=${width}`,
  12. - '-flatten',
  13. - '-density',
  14. - '300',
  15. - `${sourcePath}[0]`,
  16. + 'pdftocairo',
  17. + '-png',
  18. + '-singlefile',
  19. + '-scale-to-x',
  20. + width.toString(),
  21. + '-scale-to-y',
  22. + '-1',
  23. + sourcePath,
  24. ])
  25. }
  26. async function thumbnail(sourcePath) {
  27. - const width = '260x'
  28. - return await convert(sourcePath, 'png', [
  29. - 'convert',
  30. - '-flatten',
  31. - '-background',
  32. - 'white',
  33. - '-density',
  34. - '300',
  35. - '-define',
  36. - `pdf:fit-page=${width}`,
  37. - `${sourcePath}[0]`,
  38. - '-resize',
  39. - width,
  40. + const width = 700
  41. + return await _convert(sourcePath, 'png', [
  42. + 'pdftocairo',
  43. + '-png',
  44. + '-singlefile',
  45. + '-scale-to-x',
  46. + width.toString(),
  47. + '-scale-to-y',
  48. + '-1',
  49. + sourcePath,
  50. ])
  51. }
  52. async function preview(sourcePath) {
  53. - const width = '548x'
  54. - return await convert(sourcePath, 'png', [
  55. - 'convert',
  56. - '-flatten',
  57. - '-background',
  58. - 'white',
  59. - '-density',
  60. - '300',
  61. - '-define',
  62. - `pdf:fit-page=${width}`,
  63. - `${sourcePath}[0]`,
  64. - '-resize',
  65. - width,
  66. + const width = 1000
  67. + return await _convert(sourcePath, 'png', [
  68. + 'pdftocairo',
  69. + '-png',
  70. + '-singlefile',
  71. + '-scale-to-x',
  72. + width.toString(),
  73. + '-scale-to-y',
  74. + '-1',
  75. + sourcePath,
  76. ])
  77. }
  78. @@ -77,7 +72,7 @@
  79. const timer = new metrics.Timer('imageConvert')
  80. const destPath = `${sourcePath}.${requestedFormat}`
  81. - command.push(destPath)
  82. + command.push(sourcePath)
  83. command = Settings.commands.convertCommandPrefix.concat(command)
  84. try {