Problem/Motivation
When saving pwa config, with "Use the theme image" it shows this warning.
Warning: getimagesize(/var/www/html/webthemes/custom/paltana/logo.png): Failed to open stream: No such file or directory in Drupal\pwa\Form\ManifestConfigurationForm->submitForm() (line 370 of modules/contrib/pwa/src/Form/ManifestConfigurationForm.php).
It needs a "/" between the current directory and theme image:
We need to change this:
$image_size = getimagesize(getcwd() . $theme_image);
to this:
$image_size = getimagesize(getcwd() . '/' . $theme_image);
Steps to reproduce
Go to /admin/config/services/pwa/manifest
check on Use the theme image
Save
Proposed resolution
Apply the attached patch
Comments
Comment #3
akhil babuThanks for the patch @Carlitus. When I checked this, 'Use the theme image' option was not working for me.
theme_get_setting('logo.path', $nameOfDefaultTheme);was not returing the path to theme's logo. I have updated this totheme_get_setting('logo.url', $nameOfDefaultTheme);and its working after that. Also, we can continue to usegetcwd() . $theme_imageto get the full url of the image.I found one more issue in calculating image size. The current code is
If
$image_size[0] == $image_size[1], then the image will be square. Condition should be$image_size[0] != $image_size[1]. Corrected that also.Comment #5
akhil babuComment #6
deepalij commentedTried to reproduce the issue stated in the IS.
Did not receive such a message when tried to save pwa config, with "Use the theme image".
Couldn't reproduce.
Comment #7
anybodyThanks for the MR! Fix looks correct!
Comment #9
anybodyClear fix, thank you @Akhil Babu!
Comment #10
anybody