https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292016-04-13T12:03:24ZRedmineRedmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=703152016-04-13T12:03:24ZGregor Schmidtschmidt@nach-vorne.eu
<ul><li><strong>File</strong> <a href="/attachments/15745">0001-Render-PDF-thumbnail-using-ImageMagick-GhostScript.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/15745/0001-Render-PDF-thumbnail-using-ImageMagick-GhostScript.patch">0001-Render-PDF-thumbnail-using-ImageMagick-GhostScript.patch</a> added</li><li><strong>File</strong> <a href="/attachments/15746">pdf-thumb.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/15746/pdf-thumb.png">pdf-thumb.png</a> added</li></ul><p>I have attached an updated patch. The first one (now obsolete) was missing a change in <code>Attachment</code>, I had introduced locally for the changes in <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Respond with "No preview available" instead of sending the file when no preview is available (Closed)" href="https://www.redmine.org/issues/22482">#22482</a>.</p>
<p>I have also added a screen shot previewing the feature.</p>
<p><img src="https://www.redmine.org/attachments/download/15746/pdf-thumb.png" alt="" /></p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=703172016-04-13T13:12:35ZJan from Planio www.plan.io
<ul><li><strong>File</strong> deleted (<del><i>0001-Render-PDF-thumbnail-using-ImageMagick-GhostScript.patch</i></del>)</li></ul> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=703182016-04-13T13:15:36ZJan from Planio www.plan.io
<ul><li><strong>Target version</strong> set to <i>Candidate for next minor release</i></li></ul> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=709092016-05-11T16:10:43ZToshi MARUYAMA
<ul></ul><p>LGTM.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=711292016-05-27T14:59:26Zkay rus
<ul></ul><p>Gregor, I guess you have to update your patch because of this new feature: <a class="external" href="https://github.com/redmine/redmine/commit/bf81c96b79cc80bc4ffb08714a3d3f92e68e254a">https://github.com/redmine/redmine/commit/bf81c96b79cc80bc4ffb08714a3d3f92e68e254a</a></p>
<p>You can find some hits here: <a class="external" href="http://www.redmine.org/attachments/16039/pdf_thumbnails.patch">http://www.redmine.org/attachments/16039/pdf_thumbnails.patch</a></p>
<p>And in addition, I guess you can add tiff support ([0] is also necessary here, so I'd suggest you to add "[0]" for all images, not only for pdf, it works in my patch as well), and add some tests.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=711552016-05-30T08:56:32ZGregor Schmidtschmidt@nach-vorne.eu
<ul><li><strong>File</strong> <a href="/attachments/16047">0001-Render-PDF-thumbnail-using-ImageMagick-GhostScript.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/16047/0001-Render-PDF-thumbnail-using-ImageMagick-GhostScript.patch">0001-Render-PDF-thumbnail-using-ImageMagick-GhostScript.patch</a> added</li></ul><p>Attached you may find an updated patch (trunk <a class="changeset" title="NoMethodError: undefined method `id' error on EnumerationFormat#value_from_keyword (#22911). Pat..." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/15429">r15429</a>)</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=711562016-05-30T09:05:14ZGregor Schmidtschmidt@nach-vorne.eu
<ul></ul><p><a class="user active" href="https://www.redmine.org/users/36507">상경 김</a> rus: Thanks for additionally suggesting TIFF support in <a class="issue tracker-2 status-1 priority-4 priority-default" title="Feature: Additional filetypes (tif,tiff) for thumbnails generation (New)" href="https://www.redmine.org/issues/22915">#22915</a>. I did not include your changes into my patch to keep this issue focused. I assume, adding tiff after this change was applied will be just as easy.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=714652016-06-12T14:52:51ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-1 priority-4 priority-default" href="/issues/22915">Feature #22915</a>: Additional filetypes (tif,tiff) for thumbnails generation</i> added</li></ul> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=782412017-04-27T13:21:36ZGo MAEDA
<ul><li><strong>Has duplicate</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/16626">Feature #16626</a>: Preview first page pdf file as a jpg file</i> added</li></ul> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=783512017-05-04T09:15:59ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/18218">Render-PDF-thumbnail-using-ImageMagick-GhostScript-20170504.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/18218/Render-PDF-thumbnail-using-ImageMagick-GhostScript-20170504.patch">Render-PDF-thumbnail-using-ImageMagick-GhostScript-20170504.patch</a> added</li><li><strong>Target version</strong> changed from <i>Candidate for next minor release</i> to <i>3.4.0</i></li></ul><p>It is a great feature. We can easy guess the content of attached PDF files by seeing its thumbnail.<br />I updated the patch for the current trunk. Let's deliver this feature in the upcoming version.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=790112017-06-04T11:44:22ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/25988">Feature #25988</a>: Preview files by default instead of downloading them</i> added</li></ul> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=791412017-06-10T08:26:30ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Target version</strong> changed from <i>3.4.0</i> to <i>4.1.0</i></li></ul><p>I've just tried it on win64. <code>gswin64 -version</code> opens up a GS window and webrick waits until it's closed.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=791422017-06-10T08:32:08ZJean-Philippe Langjp_lang@yahoo.fr
<ul></ul><p>And after that, PDF support is still marked as unavailable in admin/infos.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=813072017-09-27T03:57:05ZJens Krämerjk@jkraemer.net
<ul></ul><p>I played around with this a bit and it seems that Ghostscript on Windows always opens this window, so it's pretty useless to use as a check.</p>
<p>As Gregor mentioned checking for presence of the GS executable in itself is a bit unreliable as well, since ImageMagick still might be built without PDF support. Unfortunately <code>convert -list format</code>, which lists ImageMagick's supported file types, still lists PDF even with Ghostscript not present, it merely checks what options it was compiled with but does not actually look up the actual runtime dependencies (ghostscript libraries). That's consistent with the information I found <a href="http://studio.imagemagick.org/discourse-server/viewtopic.php?t=10723" class="external">on imagemagick.org</a> . The only reliable way to determine if a certain file type can be handled is to actually try it out.</p>
<p>We could either:</p>
<p>- try to actually thumbnail a PDF once in <code>gs_available?</code><br />- or resort to just checking the presence / executability of the Ghostscript binary<br />- or introduce an option to manually enable PDF thumbnailing with proper documentation ("install ghostscript!") and completely remove the Ghostscript availability check. The more I think about it this might be the best thing to do.</p>
<p>Thoughts?</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=813082017-09-27T04:16:39ZGo MAEDA
<ul></ul><p>Jens Krämer wrote:</p>
<blockquote>
<p>- or introduce an option to manually enable PDF thumbnailing with proper documentation ("install ghostscript!") and completely remove the Ghostscript availability check. The more I think about it this might be the best thing to do.</p>
</blockquote>
<p>+1 for this. This is the most efficient and reliable way in the options, I think.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=860092018-07-03T11:05:19ZGo MAEDA
<ul></ul><p>Jens Krämer wrote:</p>
<blockquote>
<p>We could either:</p>
<p>- try to actually thumbnail a PDF once in <code>gs_available?</code><br />- or resort to just checking the presence / executability of the Ghostscript binary<br />- or introduce an option to manually enable PDF thumbnailing with proper documentation ("install ghostscript!") and completely remove the Ghostscript availability check. The more I think about it this might be the best thing to do.</p>
</blockquote>
<p>Another idea. I think there are not many people run Redmine for production on Windows, so we can simply reject Windows.</p>
<pre><code class="ruby syntaxhl"> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">gs_available?</span>
<span class="k">return</span> <span class="vi">@gs_available</span> <span class="k">if</span> <span class="k">defined?</span><span class="p">(</span><span class="vi">@gs_available</span><span class="p">)</span>
<span class="k">if</span> <span class="no">ENV</span><span class="p">[</span><span class="s1">'OS'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'Windows_NT'</span>
<span class="vi">@gs_available</span> <span class="o">=</span> <span class="kp">false</span>
<span class="k">else</span>
<span class="vi">@gs_available</span> <span class="o">=</span> <span class="nb">system</span><span class="p">(</span><span class="s2">"gs -version"</span><span class="p">)</span> <span class="k">rescue</span> <span class="kp">false</span>
<span class="vi">@gs_available</span> <span class="o">||=</span> <span class="nb">system</span><span class="p">(</span><span class="s2">"gswin32 -version"</span><span class="p">)</span> <span class="k">rescue</span> <span class="kp">false</span>
<span class="vi">@gs_available</span> <span class="o">||=</span> <span class="nb">system</span><span class="p">(</span><span class="s2">"gswin64 -version"</span><span class="p">)</span> <span class="k">rescue</span> <span class="kp">false</span>
<span class="k">end</span>
<span class="vi">@gs_available</span>
</code></pre> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=862462018-07-18T09:20:55ZStephan Wenzel
<ul></ul><p>My experience with imagemagick ist, that it is not very reliable with respect to predictability of its capabilities on different platforms. Why not let the user try on a setup page, if imagemagick is capable to handle pdf?</p>
<p>On GitHub and Redmine.org have shared two plugins [[<a class="external" href="https://www.redmine.org/plugins/redmine_preview_pdf">https://www.redmine.org/plugins/redmine_preview_pdf</a>]] and [[<a class="external" href="https://www.redmine.org/plugins/redmine_thumbnail_pdf">https://www.redmine.org/plugins/redmine_thumbnail_pdf</a>]] that use the pdf capabilities of imagemagick. I will introduce a try-if-pdf-is-availbale option on it's setup page.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=863042018-07-23T22:44:43ZMarius BĂLTEANU
<ul></ul><p>Go MAEDA wrote:</p>
<blockquote>
<p>Another idea. I think there are not many people run Redmine for production on Windows, so we can simply reject Windows.</p>
</blockquote>
<p>I’m in favour of rejecting Windows.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=893262019-01-10T08:23:15ZGo MAEDA
<ul></ul><p>I found that Redmine has <code>Redmine::Platform.mswin?</code> method. We don't have to check ENV['OS'].</p>
<p>This should be OK.</p>
<pre><code class="ruby syntaxhl"> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">gs_available?</span>
<span class="k">return</span> <span class="vi">@gs_available</span> <span class="k">if</span> <span class="k">defined?</span><span class="p">(</span><span class="vi">@gs_available</span><span class="p">)</span>
<span class="k">unless</span> <span class="no">Redmine</span><span class="o">::</span><span class="no">Platform</span><span class="p">.</span><span class="nf">mswin?</span>
<span class="vi">@gs_available</span> <span class="o">=</span> <span class="nb">system</span><span class="p">(</span><span class="s2">"gs -version"</span><span class="p">)</span> <span class="k">rescue</span> <span class="kp">false</span>
<span class="k">else</span>
<span class="vi">@gs_available</span> <span class="o">=</span> <span class="kp">false</span>
<span class="k">end</span>
<span class="vi">@gs_available</span>
<span class="k">end</span>
</code></pre> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=909452019-03-26T08:42:21ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/22704">Render-PDF-thumbnail-using-ImageMagick-GhostScript-20190326.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/22704/Render-PDF-thumbnail-using-ImageMagick-GhostScript-20190326.patch">Render-PDF-thumbnail-using-ImageMagick-GhostScript-20190326.patch</a> added</li></ul><p>Updated the patch for <a class="changeset" title="Group time entries by created date (#30233). Patch by Marius BALTEANU." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/18003">r18003</a>. Now the feature is disabled if Redmine is running on Windows.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=916912019-05-11T04:55:03ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/23020">Render-PDF-thumbnail-using-ImageMagick-GhostScript-20190511.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/23020/Render-PDF-thumbnail-using-ImageMagick-GhostScript-20190511.patch">Render-PDF-thumbnail-using-ImageMagick-GhostScript-20190511.patch</a> added</li></ul><p>Updated the patch for the current trunk <a class="changeset" title="Fix typo: s/web site/website/ (#31327)." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/18155">r18155</a>.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=916932019-05-11T07:46:34ZGo MAEDA
<ul><li><strong>File</strong> <a href="/attachments/23021">0001-Test-for-22481.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/23021/0001-Test-for-22481.patch">0001-Test-for-22481.patch</a> added</li><li><strong>File</strong> <a href="/attachments/23022">190511141819_ecookbook-gantt.pdf</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/23022/190511141819_ecookbook-gantt.pdf">190511141819_ecookbook-gantt.pdf</a> added</li></ul><p>I wrote tests for the patch. I think the patch is ready to commit.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=917032019-05-12T05:44:35ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Go MAEDA</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul><p>Committed the patch. Thank you for the great improvement.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=921692019-06-02T17:16:52ZMarius BĂLTEANU
<ul><li><strong>File</strong> <a href="/attachments/23231">0001-Run-test-only-when-GhostScript-is-available.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/23231/0001-Run-test-only-when-GhostScript-is-available.patch">0001-Run-test-only-when-GhostScript-is-available.patch</a> added</li><li><strong>Status</strong> changed from <i>Closed</i> to <i>Reopened</i></li></ul><p>We should run <code> test_thumbnail_for_pdf_should_be_png</code> only when GS is available.</p>
<p>One test fails without the patch: <a class="external" href="https://gitlab.com/redmine-org/redmine/-/jobs/223654807">https://gitlab.com/redmine-org/redmine/-/jobs/223654807</a><br />All tests pass after applying the patch: <a class="external" href="https://gitlab.com/redmine-org/redmine/-/jobs/223683936">https://gitlab.com/redmine-org/redmine/-/jobs/223683936</a></p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=921712019-06-02T23:40:19ZGo MAEDA
<ul><li><strong>Status</strong> changed from <i>Reopened</i> to <i>Closed</i></li></ul><p>Marius BALTEANU wrote:</p>
<blockquote>
<p>We should run <code> test_thumbnail_for_pdf_should_be_png</code> only when GS is available.</p>
</blockquote>
<p>Thank you for cleaning up after my mistake. Committed the fix in <a class="changeset" title="Run test only when GhostScript is available (#22481). Patch by Marius BALTEANU." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/18221">r18221</a>.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=944982019-10-22T14:58:14ZMarius BĂLTEANU
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/32307">Defect #32307</a>: AttachmentsControllerTest#test_thumbnail_for_pdf_should_be_png fails if ImageMagick convert is not available</i> added</li></ul> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=958042020-01-21T04:11:20ZAnonymous
<ul></ul><p>For windows, use "gswin64c(32c).exe"(command line version) instead of "gswin64(32).exe".<br />Now it's working on windows.<br /><pre><code class="diff syntaxhl"><span class="gd">--- org/lib/redmine/thumbnail.rb
</span><span class="gi">+++ patch/lib/redmine/thumbnail.rb
</span><span class="p">@@ -77,5 +77,6 @@</span>
if Redmine::Platform.mswin?
<span class="gd">- @gs_available = false
</span><span class="gi">+ @gs_available = system("gswin64c -version > nul 2>&1") rescue false
+ @gs_available ||= system("gswin32c -version > nul 2>&1") rescue false
</span> else
begin
</code></pre></p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=959212020-01-28T03:25:46ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/32898">Feature #32898</a>: PDF thumbnails support on Windows</i> added</li></ul> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=971862020-04-07T05:43:44ZVVD VVD
<ul></ul><p>Created a separate issue: <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: Thumbnail support for PDF attachments may not be detected (Closed)" href="https://www.redmine.org/issues/33283">#33283</a>.</p> Redmine - Feature #22481: Show thumbnails for PDF attachmentshttps://www.redmine.org/issues/22481?journal_id=973882020-04-20T13:14:31ZGo MAEDA
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/33283">Defect #33283</a>: Thumbnail support for PDF attachments may not be detected</i> added</li></ul>