Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@vmcj
Copy link
Collaborator

@vmcj vmcj commented Apr 14, 2025

Before the script would fail on logo.svg and never try logo.png now it should work based on preference and stop when the resized logo's are correctly created or try a logo with a low preference.

@deboer-tim
Copy link
Collaborator

CMS used to only allow one logo file - has that changed, or is there another case you're trying to support?

If there are two files, is also raises the question of why, and which one should take precedence?

@vmcj
Copy link
Collaborator Author

vmcj commented Apr 15, 2025

CMS used to only allow one logo file - has that changed, or is there another case you're trying to support?

If there are two files, is also raises the question of why, and which one should take precedence?

Currently my folders can have multiple files (as I download the original and change it) where some don't get picked at the moment, and if I understand the spec correctly there can be multiple logo's under /organization. And someone suggested there will be logo.svg soon, if CMS can only expose 1 this is more risky at the moment.

But if CMS should only expose 1 logo I think this PR can be closed.

@deboer-tim
Copy link
Collaborator

I'm going to respond out of order... :)

if I understand the spec correctly there can be multiple logo's under /organization

Yes, they can be different formats and sizes. As a client that's all you can tell though, so you have to assume they're all 'the same' logo in different formats/sizes and not two or three different logos. i.e. clients normally just pick a file based on their needs, e.g. prefer svg if it exists and you need a large/detailed logo, or small png for scoreboard.

Currently my folders can have multiple files (as I download the original and change it) where some don't get picked at the moment.

FWIW if I'm editing and have multiple files I just keep 'the best' as logo.svg or logo.png to make sure it's the one that's picked. I do this in a cms export folder, then periodically copy to cdp/contest archive and use ImageGenerator to generate all the other formats/sizes.

And someone suggested there will be logo.svg soon, if CMS can only expose 1 this is more risky at the moment.

In the past the CMS could only store and export one file per organization. I think it sometimes does more now (?) but I've never seen a case where the one picked up by ImageGenerator wasn't the obvious correct one, e.g. the better/latest image was the only logo.*.

I tried a couple times to get the CMS export to just comply with the spec and use logo.* as the filename. If they do store multiple files then I think we need to push on that more (or Nicky or I might be able to fix now) and there is a clear 'best' logo.

But if CMS should only expose 1 logo I think this PR can be closed.

Yeah, that's my preference. Whoever uploads to CMS or builds a contest archive should decide which logo to use (and yes, that's also us in many cases...), then tools like IG are just processing it.

@vmcj vmcj force-pushed the check_all_logos branch from 8393f16 to 7778816 Compare April 16, 2025 07:10
@vmcj
Copy link
Collaborator Author

vmcj commented Apr 16, 2025

But if CMS should only expose 1 logo I think this PR can be closed.

Yeah, that's my preference. Whoever uploads to CMS or builds a contest archive should decide which logo to use (and yes, that's also us in many cases...), then tools like IG are just processing it.

I removed the commits this discussion was about, the 2 semi-unrelated commits have been kept.

@vmcj vmcj force-pushed the check_all_logos branch from 7778816 to ba8225d Compare April 16, 2025 07:17
Copy link
Collaborator

@deboer-tim deboer-tim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment, but I'm fine merging as-is. Thanks. 👍🏼

File imgFile = null;
File[] files = folder.listFiles();
if (files == null) {
Trace.trace(Trace.ERROR, "Failed to read " + folder.getAbsolutePath());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No files could just mean the folder is empty and not a 'failure', message should probably be softened.

I'd probably move the 'File imgFile = null' down and just return null here, but that's just me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the variable as this is more explicit, and I prefer returning as soon as possible, only a matter of preference as there will not be many times where this folder has many files with different names.

@vmcj vmcj force-pushed the check_all_logos branch from ba8225d to 218df13 Compare April 16, 2025 16:43
@deboer-tim deboer-tim merged commit 0a50c4a into icpctools:main Apr 16, 2025
4 checks passed
@vmcj vmcj deleted the check_all_logos branch April 17, 2025 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants