- This topic has 13 replies, 2 voices, and was last updated 5 months ago by
David.
-
AuthorPosts
-
October 24, 2022 at 5:42 am #2384034
Jens
Hi Support-Team,
i switched a website with php 7.4 and svg-logo zu php 8/8.1. after that there are problems with width and height of the svg-logo.
error-message: undefinded array key width/height in header.php line 137+138when i change the logo to a png, i have no problems.
can you reproduce that?
regards, Jens
October 24, 2022 at 6:21 am #2384066David
StaffCustomer SupportHi there,
do you have a custom header.php on your site ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 24, 2022 at 6:24 am #2384068Jens
Hi David,
no custom header.phpOctober 24, 2022 at 6:27 am #2384070David
StaffCustomer SupportOdd, this is the themes header.php:
https://github.com/tomusborne/generatepress/blob/master/header.phpAs you can see, its only 75 lines.
But your error message refers to:in header.php line 137+138
What am i missing π ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 24, 2022 at 6:30 am #2384074Jens
Oh, sorry, it was too short.
it refers to generatepress/inc/structure/header.phpOctober 24, 2022 at 6:32 am #2384076David
StaffCustomer SupportWell silly me – having a brain fog day today – please excuse me π
So the SVG you have uploaded, if you view that in the Media Library – does it display any Width and Height attributes ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 24, 2022 at 6:35 am #2384083Jens
No, there are no width and height. Is there something missing in the svg-file?
October 24, 2022 at 6:38 am #2384088David
StaffCustomer SupportCan i see the site with that logo ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 24, 2022 at 6:47 am #2384095Jens
the warning is in .inside-header
October 24, 2022 at 6:52 am #2384101David
StaffCustomer SupportOk, so the SVG does have
width
height
and a validviewbox
attribute.
But WP can have a hard time reading those for some unexplainable reason.Try the PHP Snippet provided here:
https://docs.generatepress.com/article/generate_logo_output/#setting-a-width-and-height
in this line add your width height attributes:
<img width="999" height="999" class="header-image" src="%3$s" alt="%2$s" title="%2$s" />
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 24, 2022 at 7:10 am #2384116Jens
thanks for the link, but i think its all ok with the site, only the php-warning crashes the layout.
when i deactivate php-errors with ini_set(‘display_errors’,’off’); in wp-config.php its all fine. and i dont need the php snippet.October 24, 2022 at 7:25 am #2384133David
StaffCustomer SupportJust to note – that snippet will replace the missing
width
andheight
attributes in theimg
HTML. So it not only would fix that error, but it would make sure the Image has correct size attributes, without those you may get some CLS or resizing issues.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 24, 2022 at 7:26 am #2384135Jens
good to know, thanks a lot.
October 24, 2022 at 7:27 am #2384136David
StaffCustomer SupportYou’re welcome π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.