Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file manager: webp thumbnail not shown #1913

Closed
math-GH opened this issue Jul 6, 2020 · 24 comments
Closed

file manager: webp thumbnail not shown #1913

math-GH opened this issue Jul 6, 2020 · 24 comments

Comments

@math-GH
Copy link

math-GH commented Jul 6, 2020

Affected version(s)

Contao 4.9.3

Description
webp pictures cannot shown as thumbnail in file manager.

grafik

The picture can shown in the full view of the file manager
grafik

But cannot shown in the edit mode
grafik

as example I took a picture from the Contao demo
DSC_5403

and saved it with paint.net to webp
DSC_5403.zip

@math-GH math-GH changed the title Dateiverwaltung: webp thumbnail not shown file manager: webp thumbnail not shown Jul 6, 2020
@ausi
Copy link
Member

ausi commented Jul 6, 2020

Please post the html source code of such a WEBP thumbnail.

@math-GH
Copy link
Author

math-GH commented Jul 6, 2020

Edit mode

grafik

@math-GH
Copy link
Author

math-GH commented Jul 6, 2020

file manager
grafik

file cannot found

grafik

@ausi
Copy link
Member

ausi commented Jul 7, 2020

Which browser and browser version are you using?
What happens if you open assets/images/2/header-8ecd4f77.webp directly in the browser, does the network-tab show an error 500 then?

@math-GH
Copy link
Author

math-GH commented Jul 10, 2020

Which browser and browser version are you using?
What happens if you open assets/images/2/header-8ecd4f77.webp directly in the browser, does the network-tab show an error 500 then?

Firefox 78 (current version), Windows 10

Error 404
grafik

@ausi
Copy link
Member

ausi commented Jul 11, 2020

Please update to Contao 4.9.4. This should show a 500 error instead of the 404 and show up in the error log.

@math-GH
Copy link
Author

math-GH commented Jul 11, 2020

ok. In Contao 4.9.4 the error code changed to 500.
But it is a technical solution.

The back end GUI shows the same problem: it does not show the webp-image. only the border.

I as user expect: a working thumbnail or no thumbnail (like a pdf file)

@ausi
Copy link
Member

ausi commented Jul 11, 2020

What does the error log say?

@math-GH
Copy link
Author

math-GH commented Jul 11, 2020

Which error log?

System log: nothing.

Symphony log:
grafik

@fritzmg
Copy link
Contributor

fritzmg commented Jul 11, 2020

If you use the profiler, you need to show the profile of the request responding with the 500 status. Otherwise you need to look into var/logs.

@math-GH
Copy link
Author

math-GH commented Jul 11, 2020

[2020-07-11 15:09:48] request.INFO: Matched route "contao_images". {"route":"contao_images","route_parameters":{"_route":"contao_images","_controller":"Contao\\CoreBundle\\Controller\\ImagesController","_bypass_maintenance":true,"path":"2/header-8ecd4f77.webp"},"request_uri":"https://domain.tld/assets/images/2/header-8ecd4f77.webp","method":"GET"} []
[2020-07-11 15:09:48] request.CRITICAL: Uncaught PHP Exception Imagine\Exception\RuntimeException: "Unable to open image /xxx/yyy//files/structure/header/header.webp" at /xxx/yyy//vendor/imagine/imagine/src/Imagick/Imagine.php line 77 {"exception":"[object] (Imagine\\Exception\\RuntimeException(code: 435): Unable to open image /xxx/yyy//files/structure/header/header.webp at /xxx/yyy//vendor/imagine/imagine/src/Imagick/Imagine.php:77, ImagickException(code: 435): unable to open image `/tmp/magick-546205rOalqn6xTrtz': No such file or directory @ error/blob.c/OpenBlob/2712 at /xxx/yyy//vendor/imagine/imagine/src/Imagick/Imagine.php:69)"} []
[2020-07-11 15:16:50] request.INFO: Matched route "contao_images". {"route":"contao_images","route_parameters":{"_route":"contao_images","_controller":"Contao\\CoreBundle\\Controller\\ImagesController","_bypass_maintenance":true,"path":"2/header-8ecd4f77.webp"},"request_uri":"https://domain.tld/assets/images/2/header-8ecd4f77.webp","method":"GET"} []
[2020-07-11 15:16:50] request.CRITICAL: Uncaught PHP Exception Imagine\Exception\RuntimeException: "Unable to open image /xxx/yyy//files/structure/header/header.webp" at /xxx/yyy//vendor/imagine/imagine/src/Imagick/Imagine.php line 77 {"exception":"[object] (Imagine\\Exception\\RuntimeException(code: 435): Unable to open image /xxx/yyy//files/structure/header/header.webp at /xxx/yyy//vendor/imagine/imagine/src/Imagick/Imagine.php:77, ImagickException(code: 435): unable to open image `/tmp/magick-546205ResKnuiPf9LX': No such file or directory @ error/blob.c/OpenBlob/2712 at /xxx/yyy//vendor/imagine/imagine/src/Imagick/Imagine.php:69)"} []

@fritzmg
Copy link
Contributor

fritzmg commented Jul 11, 2020

Btw. if you do use the debug mode, you can go into the profiler and then click on "Last 10" in the top left, to get a list of the last 10 profiled requests. There you can select the one with the 500 status and access its stack trace, which you then can post here.

Also, please post error messages etc. in three back ticks, not just one :)

@ausi
Copy link
Member

ausi commented Jul 11, 2020

It looks like something is wrong with your ImageMagick setup.

Please create a php file on your webspace with the following contents (replacing /xxx/yyy/ with the actual path):

<pre><?php
var_dump(\Imagick::queryFormats());
var_dump(new \Imagick('/xxx/yyy//files/structure/header/header.webp'));

And post the output here.

@math-GH
Copy link
Author

math-GH commented Jul 11, 2020

I put it in test.php.

The results:

  [0]=>
  string(3) "3FR"
  [1]=>
  string(3) "AAI"
  ...
  [197]=>
  string(3) "VST"
  [198]=>
  string(4) "WBMP"
  [199]=>
  string(3) "WMF"
  [200]=>
  string(3) "WMV"
  [201]=>
  string(3) "WMZ"
  [202]=>
  string(3) "WPG"
  [203]=>
  string(1) "X"
  [204]=>
  string(3) "X3F"
  [205]=>
  string(3) "XBM"
  [206]=>
  string(2) "XC"
  [207]=>
  string(3) "XCF"
  [208]=>
  string(3) "XPM"
  [209]=>
  string(3) "XPS"
  [210]=>
  string(2) "XV"
  [211]=>
  string(3) "XWD"
  [212]=>
  string(5) "YCbCr"
  [213]=>
  string(6) "YCbCrA"
  [214]=>
  string(3) "YUV"
}


Fatal error:  Uncaught ImagickException: unable to open image `/tmp/magick-1645662bZCkdKd2iZw4': No such file or directory @ error/blob.c/OpenBlob/2712 in /xxx/yyy/web/test.php:3
Stack trace:
#0 /xxx/yyy/web/test.php(3): Imagick->__construct('/xxx...')
#1 {main}
  thrown in /xxx/yyy/web/test.php on line 3

@math-GH
Copy link
Author

math-GH commented Jul 11, 2020

Hoster: Alfahosting.

cut out of phpinfo():
grafik

@math-GH
Copy link
Author

math-GH commented Jul 11, 2020

in "gd" the webp support is enabled

grafik

@ausi
Copy link
Member

ausi commented Jul 12, 2020

So it looks like WEBP is not supported with ImageMagick on your webspace.

in "gd" the webp support is enabled

In this case you could switch to GD to get WEBP support:

contao:
    image: 
        imagine_service: 'contao.image.imagine.gd'

@ausi
Copy link
Member

ausi commented Jul 12, 2020

I created a pull request #1932 to make it easier in the future to debug such errors.

@math-GH
Copy link
Author

math-GH commented Jul 12, 2020

So it looks like WEBP is not supported with ImageMagick on your webspace.

in "gd" the webp support is enabled

In this case you could switch to GD to get WEBP support:

contao:
    image: 
        imagine_service: 'contao.image.imagine.gd'

In which file do I have to write that configuration?
config/parameters.yaml?

@fritzmg
Copy link
Contributor

fritzmg commented Jul 12, 2020

config/config.yml

@math-GH
Copy link
Author

math-GH commented Jul 12, 2020

Perfect. It works after I refreshed the Symphony cache (in contao manager).

In the same time I asked the support of Alfahosting to enable Webp in ImageMagick (yet waiting for answer)

@math-GH
Copy link
Author

math-GH commented Jul 13, 2020

Alfahosting will not and does not want change the ImageMagick configs.

@ausi
Copy link
Member

ausi commented Jul 14, 2020

I think this issue can be closed then. Do you agree @mathContao​?

leofeyer pushed a commit that referenced this issue Jul 15, 2020
Description
-----------

#1913 was another case where the `contao.image.valid_extensions` caused confusion. I think especially because the IMagick error message is not very descriptive. We tried triggering a warning at container build time in #1815 (comment) but concluded that it might not be a good idea.

How about improving the error message of the exception?

Before:
<img width="856" alt="Bildschirmfoto 2020-07-12 um 10 51 56" src="https://user-images.githubusercontent.com/367169/87242551-fcad2700-c42d-11ea-9269-979670e8762b.png">

After:
<img width="857" alt="Bildschirmfoto 2020-07-12 um 10 51 27" src="https://user-images.githubusercontent.com/367169/87242555-033b9e80-c42e-11ea-8128-b622364ee43a.png">

Commits
-------

e44ff13 Improve error message for unsupported image formats
@math-GH
Copy link
Author

math-GH commented Jul 17, 2020

I think this issue can be closed then. Do you agree @mathContao​?

yes. Thank you for your help

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants