Closed (fixed)
Project:
ImageMagick
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Jan 2018 at 09:15 UTC
Updated:
10 Jul 2019 at 11:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
anas_maw commentedThis patch solve the issue
Comment #3
mondrakeThank you @Anas_maw!
The proposed change makes sense - as it makes generally sense to check if an object exists before trying to invoke one of its methods. However, that will mean that the Image object will not be valid afterwards.
Can you elaborate a bit as to why at that point in code the file metadata manager service cannot set the URI for
$this->getSource()?Comment #4
mondrakeComment #5
mondrakeComment #6
michael.chadwick commentedI am hitting the same error but I do not believe it is specifically related to WYSIWYG. From my investigation it looks like it has something to do with Media passing ImageMagick the no-thumbnail.png or the generic.png at a relative path before the image itself.
My scenario:
I have Drupal core (8.5.6) Media enabled and 2 media types configured from from that Image and Document. I get the error reported above when trying to create either of the media types via their default media add forms.
Sticking a breakpoint on line 1212 shows me that ImageMagick is passed '/no-thumbnail.png' or the '/generic.png' paths before the actual image from the file upload field. These files don't seem to be getting picked up as part of the
fileMetadataManagerprocess. Assuming due to their relative paths. When you see the actual image that was uploaded go through the same process it has an absolute path to it in the files folder and works as expected.The no-thumbnail.png was due to me having Queue thumbnail downloads checkbox checked on my Image media entity. Turning that off will allow me to save my Image media. The problem with my Document media entity which has a file field with .pdf extensions. ImageMagick is having the generic.png passed to it on a file upload. As far as I can see there is no way to prevent this. Meaning my documents will always fail to upload.
When I apply the #2 patch I am able to save both media types. In response #3 I believe a check here is valid, probably one that would gracefully fail if the image is not accessible for whatever reason.
Comment #7
maximpodorov commentedRe-roll.
Comment #8
mondrakeCan anybody with the issue please enable some debugging:
-debug Allargument in the 'Prepend arguments' textboxthis will capture an actually very verbose log of all the internal operations performed by the executable (http://www.imagemagick.org/script/command-line-options.php#debug) in the dblog. Then post the results.
Comment #9
bdanin commentedThe error output from before the patch in #7 is below. The patch in #7 allowed uploads in entity-browser to work again, thanks!
Comment #10
mondrakeThank you all for the input, I could reproduce the error.
1. I find *very* strange that the image system tries to open an image file located at '/generic.png', that would mean it would be at the root at the file system - unlikely it will be there. Probably some part of the entire file path is not passed in in the
ImageFactory->get()call. But that is another issue.2. Patch here is good, as it ensures the Image object is invalid. We are clearly missing a basic test to check that an attemp to load a missing file does not fatal out.
Working on adding an appropriate test.
Comment #11
mondrakeAdding tests and enhancing a bit the logic.
Comment #13
mondrakeComment #15
mondrakeCommitted and pushed to 8.x-3.x, working on backport to 8.x-2.x
Comment #16
mondrakeComment #17
mondrakeComment #20
mondrakeComment #22
mondrakeCommitted backport and pushed to 8.x-2.x