Defect #40763
openImages missing from PDF Export
0%
Description
When I export to PDF almost all images are missing:
- PNG
- JPG
I have seen a couple of exceptions (the one I was just looking at was a jpg that was rendered where other jpg on the same page did not).
I attach an example screenshot, PDF and source. NOTE: This example is using {width:30%} to control image widths (something I did not even know was possible!) but I tried removing that and it made no difference.
Files
Updated by popy popy about 1 month ago
I also experienced such issue when using ckeditor and pasting the image with CTRL-V.
The images will be populated like:
<img src="https://1.2.3.4/attachments/download/1104">
the function get_image_filename looks like this in 5.0.5:
def get_image_filename(attrname)
atta = RDMPdfEncoding.attach(@attachments, attrname, "UTF-8")
if atta
return atta.diskfile
# rubocop:disable Lint/DuplicateBranch
elsif %r{/attachments/download/(?<id>[^/]+)/} =~ attrname and
atta = @attachments.find{|a| a.id.to_s == id} and
atta.readable? and atta.visible?
return atta.diskfile
# rubocop:enable Lint/DuplicateBranch
elsif %r{/attachments/thumbnail/(?<id>[^/]+)/(?<size>\d+)} =~ attrname and
atta = @attachments.find{|a| a.id.to_s == id} and
atta.readable? and atta.visible?
return atta.thumbnail(size: size)
else
return nil
end
end
as you can see the line:
elsif %r{/attachments/download/(?<id>[^/]+)/} =~ attrname and
is checking for a trailing "/" (slash) which my redmine does not insert!
-> the issue occures.
To fix this i have changed the line to:
elsif %r{/attachments/download/(?<id>[^/]+)} =~ attrname and
Just removed the trailing slash.
And now it works just fine.
Here in beyond compare: https://imgur.com/a/3nEVTtb