WordPress.org

Forums

Customizr
IE Logo - Permanent fix? (5 posts)

  1. machound
    Member
    Posted 1 year ago #

    As a follow up to an issue I had where my logo would not appear in IE, I am reposting this in the hope that the developer will include a permanent fix in the next update.

    The fix is as follows:

    Check in class-header-header_main.php at row 148 and 149. Width and height is originally set to

    = ' ';

    and IE interprets this as 1px and makes your image "invisible".

    I had to change in in the php code to:

    $width = '250';
    $height = '100';

    and then the image magically appeared in IE.

    Thanks for a great theme by the way!

  2. d4z_c0nf
    Member
    Posted 1 year ago #

    But as you can see, in customizr/inc/class-header-header_main.php lines 151-154:

    if ( @getimagesize($logo_src) ) {
    				list( $width, $height ) = getimagesize($logo_src);
    			}

    so those width and height should be set with the return values of that php function. And this is done server side, so not an IE issue.
    I think that for you, and for all of you who have this issue, that if is skipped ( @getimagesize($logo_src) returns false )
    The reason? Dunno.
    What happens is, because of that problem width and height become '' and IE then interprets them as you said. But the problem is upstream.
    I've downloaded your gif logo, and tested it in local, and I can see width=250 height=100 in the page source (without change class-header-header_main.php), and of course works with IE (version 8 on an old xp :D). What happens if you revert your changes and look at the image width and height, in the source page, with a different browser?

  3. machound
    Member
    Posted 1 year ago #

    Reverted changes as you suggested and get the following source code:

    Google Chrome (Mac):

    <a class="site-logo" href="http://www.portcullisconsulting.co.uk/" title="Portcullis Consulting | Creative technology driven by business insight"><img src="http://www.portcullisconsulting.co.uk/wp-content/uploads/2014/05/Logo-with-Drop-Shadow.gif" alt="Back Home" width="" height="" style="max-width:250px;max-height:100px" /></a>

    Firefox (Mac):

    <a class="site-logo" href="http://www.portcullisconsulting.co.uk/" title="Portcullis Consulting | Creative technology driven by business insight"><img src="http://www.portcullisconsulting.co.uk/wp-content/uploads/2014/05/Logo-with-Drop-Shadow.gif" alt="Back Home" width="" height="" style="max-width:250px;max-height:100px" /></a>

    Safari (Mac):

    <a class="site-logo" href="http://www.portcullisconsulting.co.uk/" title="Portcullis Consulting | Creative technology driven by business insight"><img src="http://www.portcullisconsulting.co.uk/wp-content/uploads/2014/05/Logo-with-Drop-Shadow.gif" alt="Back Home" width="" height="" style="max-width:250px;max-height:100px" /></a>

    So, I guess that Safari, Chrome and Firefox manage to display the image without the width and height specified, but IE 9 on Windows 8 doesn't.

    Don't use IE myself but I guess there are still a lot of unenlightened individuals who do!

    FYI - I'm hosting site on 1and1 servers (Linux) and installed WP via FTP, not the one-click install offered by 1and1 Control Panel.

  4. ElectricFeet
    Member
    Posted 1 year ago #

    Mine are sizeless too.

    Also, if you change the code so that the $logo_src is incorrect, the page takes forever to load (could be the cause of problems with logo in the past). php's @ is described as "dog slow" here.

    I wonder how we could improve this tiny bit of code without using the @.

    We've got this far in the function to know the file exists and it's a valid image file. Under what circumstances would getimagesize not work?

  5. d4z_c0nf
    Member
    Posted 1 year ago #

    @machound

    Wanna try if this works for you?
    Replace lines 147 to 173 ( $width='' .... );) with this:

    $logo_size    = '';
    //gets height and width from image, we check if getimagesize can be used first with the error control operator
    if ( @getimagesize($logo_src) ) {
        $logo_size = getimagesize($logo_src)[3];
    }
    ?>
    
    <div class="<?php echo $logo_class ?>">
    
        <?php
        do_action( '__before_logo' );
    
        printf( '<a class="site-logo" href="%1$s" title="%2$s | %3$s"><img src="%4$s" alt="%5$s" %6$s %7$s /></a>',
            apply_filters( 'tc_logo_link_url', esc_url( home_url( '/' ) ) ) ,
            apply_filters( 'tc_site_name_text', __( esc_attr( get_bloginfo( 'name' ) ) ) ),
            apply_filters( 'tc_tagline_text', __( esc_attr( get_bloginfo( 'description' ) ) ) ),
            $logo_src,
            ( 'Back Home' , 'customizr' ),
            $logo_size,
            ( 1 == $logo_resize) ? sprintf( 'style="max-width:%1$spx;max-height:%2$spx"',
                                    apply_filters( '__max_logo_width', 250 ),
                                    apply_filters( '__max_logo_height', 100 )
                                    ) : ''
        );

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic