issue_31527.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. --- services/filestore/app/js/FileConverter.js
  2. +++ services/filestore/app/js/FileConverter.js
  3. @@ -22,49 +22,44 @@ export default {
  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. @@ -78,7 +73,8 @@ async function _convert(sourcePath, requestedFormat, command) {
  79. const timer = new metrics.Timer('imageConvert')
  80. const destPath = `${sourcePath}.${requestedFormat}`
  81. - command.push(destPath)
  82. + const outputBaseName = sourcePath
  83. + command.push(outputBaseName)
  84. command = Settings.commands.convertCommandPrefix.concat(command)
  85. try {