Jump to content

Manual talk:$wgLogos

About this board

The code to display the logo does not work (Vector 2022)

17
Monocero (talkcontribs)

Hi, I have set the Vector 2022 skin as the main skin for my MediaWiki, unfortunately the logo is not displayed. Old and new code not working. I have a logo file in the main Mediawiki folder/images/logo and unfortunately I no longer have any idea why the logo is not showing on my MediaWiki.

This old code doesn't work:

$wgLogo = "{$wgScriptPath}/images/logo/logo.png";

This new code doesn't work either:

$wgLogos = [
    '1x' => "$wgResourceBasePath/images/logo/logo.png",

This code doesn't work either:

$wgLogos = [
    '1x' => "/images/logo/logo.png",     // Ścieżka do wersji 1x (PNG)
    '1.5x' => "/images/logo/logo.png",  // Ścieżka do wersji 1.5x (PNG)
    '2x' => "/images/logo/logo.png",     // Ścieżka do wersji 2x (PNG)
    'svg' => "/images/logo/logo.svg",   // Ścieżka do wersji SVG (preferowana)

Please help.

Jonathan3 (talkcontribs)

I'm going to guess that $wgScriptPath is not empty, which would mean that "{$wgScriptPath}/images/logo/logo.png" and "/images/logo/logo.png" are different. What happens when you update the $wgLogos array accordingly?

Monocero (talkcontribs)

If I understood correctly, I removed the old code from the file:

$wgLogo = "{$wgScriptPath}/images/logo/logo.png";

And I added this code:

$wgLogos = [
    '2x' => "/images/logo/logo.png",     // Ścieżka do wersji 2x (PNG)

];

And unfortunately my logo is not displayed, only this is displayed:

https://i.imgur.com/Vr7wl8V.png

So why is the path to the logo incorrect when the logo.png file is located in the main MediaWiki/images/logo/ folder

Jonathan3 (talkcontribs)

Why not try what I suggested above? Each time you see "/images/logo/logo.png" replace it with "{$wgScriptPath}/images/logo/logo.png".

Likely $wgScriptPath is "https://www.example.com" so it'll mean you end up with the URL of your logo.

Monocero (talkcontribs)

If you mean code like this:

$wgLogos = [
    '1x' => "$wgScriptPath/images/logo/logo.png",
    '1.5x' => "$wgScriptPath/images/logo/logo.png",
    '2x' => "$wgScriptPath/images/logo/logo.png",
    'svg' => "$wgScriptPath/images/logo/logo.svg",
];

Unfortunately, this code does not display the logo in Vector 2022 either. It is strange that the official MediaWiki code does not work on my Wiki.

Jonathan3 (talkcontribs)

What URL can you type into the web browser to display the logo on its own?

What happens when you use that each time, e.g. '1x' => 'https://www.example.com/images/logo/logo.png',?

Monocero (talkcontribs)

This is the address for my logo:

https://www.golarze.pl/golarzopedia/images/logo/logo.png

Maybe it's a bad logo? But this way doesn't work either:

$wgLogos = 
   '1x' => 'https://www.golarze.pl/golarzopedia/images/logo/logo.png',
   '1.5x' => 'https://www.golarze.pl/golarzopedia/images/logo/logo.png',
   '2x' => 'https://www.golarze.pl/golarzopedia/images/logo/logo.png',
Monocero (talkcontribs)

Hi. It's been a while and I still haven't received any help on how to resolve this issue.

Jonathan3 (talkcontribs)

Maybe you're setting $wgLogos twice (by mistake) in your LocalSettings.php?

Monocero (talkcontribs)

No, when I added this code, this logo displays on Wektor 2010 but not on Wektor 2022.

$wgLogos = [ '1x' => "$wgScriptPath/images/logo/logo.png", // Ścieżka do wersji 1x (PNG) ];

I have no idea why the logo is not displayed on Vector 2022. It must be a bug in Vector 2022.

Monocero (talkcontribs)

@Jonathan3

Where can I report this bug to the MediaWiki developers? Can you help me?

Iridescentstarling (talkcontribs)

@Monocero I had exactly the same issue until I noticed on wikipedia.org that the element showing the logo was actually the ICON! I duplicated my '1x' to 'icon' and then it finally showed up.

So for your example this should be:

$wgLogos = [
  'icon' => '//www.golarze.pl/golarzopedia/images/logo/logo.png',
  '1x' => '//www.golarze.pl/golarzopedia/images/logo/logo.png',
];

IMO this should definitely be included in the Manual because it's what's required for the default Vector theme after all!

Monocero (talkcontribs)

@Iridescentstarling

Thank you for the information. It works this way, but the logo is displayed small at 50x50. Is there anything I can do to make it appear larger?

Monocero (talkcontribs)

@Bawolff

Would you be able to answer this for me?

Bawolff (talkcontribs)

You can change the logo image to one that is bigger

Monocero (talkcontribs)

The logo file has a size of 150x150, but this size does not display in Vector 2022

Monocero (talkcontribs)

@Bawolff

Why can't the graphic logo in Vector 2022 be displayed, e.g. 150x150, only as a small icon? It's been a long time since I started this help thread and I still don't know.

Reply to "The code to display the logo does not work (Vector 2022)"
Summary by Kerel-fs

Thank you for your answers and your work on MediaWiki!

Kerel-fs (talkcontribs)

There should be a simple minimal example. Ideally this would also only use options not planned to be deprecated in the future, but promoting the use of the icon version only might break with some skins for now. I'm relatively new to MediaWiki and thus not editing the Manual directly, but this is my proposal:

$wgLogos = [
	'1x' => "path/to/1x_version.png",		// path to 1x version
];
Kjecl (talkcontribs)

$wgLogos = [

       '1x' => "{$wgScriptPath}/myCustomLogo.png"               // path to 1x version

];

... worked for me.

Jdforrester (WMF) (talkcontribs)
2003:EE:9718:2D00:A5BE:217E:585B:BF3B (talkcontribs)

I updated from an old 1.31 Mediawiki to 1.39. My wiki logo is gone and I have not the slightest idea how to bring it back, because this manual goes over my noob head. I tried svg, it doesnt work. I tried icon, it doesnt work. And I don't understand what they want from me with this resize and nominally stuff.

I just want a single path for my logo, which is not required to be resizeable, has no tagline, no wordmark or other fancy things. This was once a simple function, who made it so complicated? And why is there no option for those, who just want to slap a logo in their wiki?

Why was $wgLogo decapitated and not just made a fallback?

Jdforrester (WMF) (talkcontribs)

Why was $wgLogo decapitated and not just made a fallback?

It is. If you do not set $wgLogos to anything, the wiki software will use the value of $wgLogo. However, if you have $wgLogos set, which the installer does, you'll get that value instead. However, to just simply set it the way you probably want, replace the entry in LocalSettings.php with something like this:

$wgLogos = [
    '1x' => "$wgResourceBasePath/myCustomLogo.png",
];

(This is for if your wiki's logo is stored directly in the root directory of your copy of MediaWiki, and is called myCustomLogo.png.)

Reply to "I'm totally lost"

"The key will be deprecated"

2
Brnd12 (talkcontribs)

... is not a thing in software development.

Features are either deprecated, or not.

If they are planned for removal, they are deprecated now.

If they are not planned for removal, then mentioning deprecation in documentation makes no sense.

Jdforrester (WMF) (talkcontribs)

In MediaWiki, "deprecation" is a formal process that involves documentation of how to migrate to the next step etc., which is not ready yet, so this is correct, if confusing.

Reply to ""The key will be deprecated""

Order of preference for logos

1
Amousey (talkcontribs)

Any information on the order of preference and rules for choosing which logo file will be used?

If this varies by skin then vector-2022, Skin:Timeless and Skin:Monobook information would be most useful.

Is the logo chosen to display also dependent on viewer's screen size? Does the responsive user preference affect this?

Which classes relate to which files would also be helpful to know, particularly .mw-logo-container.

Logos that can be defined are:

  • 1x (135w up to 155h) - used as background image
  • 1.5x (202w)
  • 2x (270w)
  • svg (deprecated and not recommended)
  • icon (50x50 or 100x100) .mw-logo-icon
  • wordmark (135w) .mw-logo-wordmark
  • tagline (135w) img.mw-logo-tagline
  • (no icon, use SITENAME in text) .#p-logo-text inheriting font/colors from .mw-logo-wordmark?

(icon, Wordmark and tag line appear to be used to combine into a single 3-part image)

On MW1.39 it appears that the text sitename may be overlaid on top of the Wordmark (when responsive on, for small screens)

Reply to "Order of preference for logos"

What file is $wgLogos in and where is that file?

2
Awfki (talkcontribs)

It seems like this page would include that info.

Awfki (talkcontribs)

Ooh! I found this "(Note: The default value of this variable depends on other variables, such as the values set in Setup.php, after LocalSettings.php is executed)" but I would note that anything in parenthesis is, by definition, not going to grab the eye.

I suggest that there should be a line that something like "Variable is set in: LocalSettings.php" or something similarly obvious. I looked at that page several times before I noticed the line in parens. And of course that was right after I asked because you can't find the answer until you ask someone.

Reply to "What file is $wgLogos in and where is that file?"

Failed parsing 'srcset' attribute value since it has an unknown descriptor.

4
Rbirmann (talkcontribs)

After migating from wgLogo to wgLogos, I am getting multiple warnings for "Failed parsing 'srcset' attribute value since it has an unknown descriptor." and "Dropped srcset candidate ..." on Chrome console.

Here is my exact code on LocalSettings:

$mylogospath = "$wgScriptPath/customizations/logos/v02";

$wgLogos = [
	'1x' 	=> "$mylogospath/1x.png",
	'1.5x' 	=> "$mylogospath/1_5x.png",
	'2x' 	=> "$mylogospath/2x.png",
	'svg' 	=> "$mylogospath/vetor.svg",
	'icon' 	=> "$mylogospath/1x.png",	// A version of the logo without wordmark and tagline
	'wordmark' => [
		'src' => "$mylogospath/wm.png",	// path to wordmark version
		'1x'  => "$mylogospath/wm.svg",	// optional if you want to support browsers with SVG support with an SVG logo.
		'width' => 120,
		'height' => 25,
	],
];

And here is the console output:

Failed parsing 'srcset' attribute value since it has an unknown descriptor.
Failed parsing 'srcset' attribute value since it has an unknown descriptor.
Failed parsing 'srcset' attribute value since it has an unknown descriptor.
Failed parsing 'srcset' attribute value since it has an unknown descriptor.
Failed parsing 'srcset' attribute value since it has an unknown descriptor.
Failed parsing 'srcset' attribute value since it has an unknown descriptor.
Dropped srcset candidate "/w/customizations/logos/v02/vetor.svg"
Dropped srcset candidate "/w/customizations/logos/v02/1x.png"
Dropped srcset candidate "Array"
Dropped srcset candidate "/w/customizations/logos/v02/vetor.svg"
Dropped srcset candidate "/w/customizations/logos/v02/1x.png"
Dropped srcset candidate "Array"

Here's the generated img tag on my wiki:

<img alt="Mediawiki" decoding="auto" src="/w/customizations/logos/v02/1x.png" srcset="/w/customizations/logos/v02/1_5x.png 1.5x, /w/customizations/logos/v02/2x.png 2x, /w/customizations/logos/v02/vetor.svg svg, /w/customizations/logos/v02/1x.png icon, Array wordmark"/>

So, the thing is Mediawiki is passing invalid descriptors to the srcset attribute of the img tag, namely 'svg', 'icon' and 'wordmark'.

Any thoughts??

Cheers

Mainframe98 (talkcontribs)
Rbirmann (talkcontribs)

It is Timeless indeed.

Mainframe98 (talkcontribs)
Reply to "Failed parsing 'srcset' attribute value since it has an unknown descriptor."

Why are images now stored in LocalSettings?

2
149.167.172.126 (talkcontribs)

With $wgLogos storing a binary encoded representation in this file means the majority of this file is hexidecimal values rather than the human-readable content that the settings of the site is supposed to represent. Are we going to be putting ALL images in this file going forward now? Why it wrong with linking the logo to a file containing the logo?

Jdforrester (WMF) (talkcontribs)

Hey there, I don't understand. There shouldn't be a binary representation in the file, it's an array of links as documented. Why do you think it's a binary representation?

Reply to "Why are images now stored in LocalSettings?"

Meaning of 'svg: the key will be deprecated in future' in given context?

2
Beet keeper (talkcontribs)

I am finding the following guidance confusing:

The svg version replaces the need for a 1x, 1.5x, and 2x version, but should follow the same nominal size guidelines, fitting within 135px wide and 155px tall when resized to 135px wide. The key will be deprecated in future and its use is not recommended.

SVG can fulfil the need of three other keys, so do users need to use the three other keys, or do they need to prepare for SVG being deprecated? (It is hard to believe the SVG is being deprecated given this.)

Michael Z Freeman (talkcontribs)

There's something confusing about all the text. The page needs rewriting, as actually $wgLogos is easy to understand, its just that the page makes it seem complicated. Also I can understand the need for having more sophisticated logo control, but the simpler single image method $wgLogo should have been left and not deprecated. It's just quicker and simpler especially for personal wiki's and so forth.

Reply to "Meaning of 'svg: the key will be deprecated in future' in given context?"
Woozle (talkcontribs)

This text appears to have become separated from the paragraph to which it belongs:

Instead, the image will be cut off so that only part of it (the upper left-hand corner to be precise) will be visible. If this corner is completely white, it might look like the image would not display although in fact it does.

I haven't been able to figure out where it belongs, however.

Reply to "leftover text"