5

OK, so I want to change the logo.svg with my own logo which is .jpg file (should be supported by Magento 2.0.7) Created my new theme with all directories and files, selected the theme in the admin page. Theme is working and but still using the logo.svg so far: enter image description here

Now I added my logo under the web/images folder and made the following change to the default.xml under Magento_theme/layout which is in my theme folder (/app/design/frontend/espressoplaza/standaardep/Magento_theme/layout):

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="header.container">
        <container name="header.panel.wrapper" htmlClass="panel wrapper"   htmlTag="div" before="-"/>
        </referenceContainer>
        <referenceBlock name="logo">
    <arguments>
    <argument name="logo_file"  xsi:type="string">images/testlogo480x170.jpg</argument>
    <argument name="logo_img_width" xsi:type="number">480</argument>
    <argument name="logo_img_height" xsi:type="number">170</argument>
</arguments>
</referenceBlock>
        <move element="header.panel" destination="header.panel.wrapper"/>

I cleared all static content per script:

#!/bin/bash
rm -R ~/public_html/pub/static/frontend/
rm -R ~/public_html/var/view_preprocessed/css/frontend/
rm -R ~/public_html/var/view_preprocessed/source/frontend/
rm -R ~/public_html/var/cache
rm -R ~/public_html/var/generation

And cleaned the cache. Still Magento is picking up the logo.svg from Blanc

What am I overlooking or doing wrong here.....

Thanks, Ron

0

4 Answers 4

5

Try to set a new argument in the xml for the logo block something like:

<referenceBlock name="logo">
    <arguments>
        <argument name="logo_img_width" xsi:type="number">147</argument>
        <argument name="logo_img_height" xsi:type="number">103</argument>
        <argument name="logo_file" xsi:type="string">your_logo.img</argument>
    </arguments>
</referenceBlock>
1

It seems logo_src argument should work, as Vlad Patru pointed https://magento.stackexchange.com/a/217677/3566

Magento\Theme\Block\Html\Header\Logo

/**
 * Get logo image URL
 *
 * @return string
 */
public function getLogoSrc()
{
    if (empty($this->_data['logo_src'])) {
        $this->_data['logo_src'] = $this->_getLogoUrl();
    }
    return $this->_data['logo_src'];
}
0

You have to change your image inside

mytheme\web\images\logo.svg

Then Run the below Command

php bin/magento cache:flush

php bin/magento cache:clean

then try

1
  • Thanks for reply, does your solution implies I can only use an image of the svg format? I understood Magento also supports jpg.
    – ron
    Commented Oct 1, 2016 at 10:01
0

Upload logo from admin panel from given below path (for magento 2.1.0 version):-

Content -> Design -> Configuration -> applied-theme -> Header - > Logo Image

And you can upload your logo image here jpg/png/gif format.

  • save and clear cache.

php bin/magento c:f

1
  • 1
    Thanks for your reply, I am familiar with this way to change the logo, however from a learning perspective I am trying to find out why the default.xml doesnt do the trick for me....
    – ron
    Commented Oct 1, 2016 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.