Skip to content

Commit

Permalink
Force max thumbnail size in CSS to scale down SVGs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevinjil committed Feb 28, 2025
1 parent 540ce7c commit 1029abe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions webapp/src/Controller/Jury/SubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ public function viewAction(
'requestedOutputCount' => $requestedOutputCount,
'version_warnings' => [],
'isMultiPassProblem' => $submission->getProblem()->isMultipassProblem(),
'thumbnailSize' => $this->config->get('thumbnail_size'),
];

if ($selectedJudging === null) {
Expand Down
1 change: 1 addition & 0 deletions webapp/src/Controller/Team/SubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public function viewAction(Request $request, int $submitId): Response
'showSampleOutput' => $showSampleOutput,
'runs' => $runs,
'showTooLateResult' => $showTooLateResult,
'thumbnailSize' => $this->config->get('thumbnail_size'),
];
if ($actuallyShowCompile) {
$data['size'] = 'xl';
Expand Down
7 changes: 6 additions & 1 deletion webapp/templates/jury/submission.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
.judging-table tr.disabled td a {
color: silver
}
.image_thumb {
max-width: {{ thumbnailSize }}px;
max-height: {{ thumbnailSize }}px;
}
</style>
{% endblock %}
Expand Down Expand Up @@ -743,7 +748,7 @@
{% set imgUrl = path('jury_problem_testcase_fetch', {'probId': submission.problem.probid, 'rank': run.rank, 'type': 'image'}) %}
<a href="{{ imgUrl }}">
{% set EXTENSION_TO_MIMETYPE = constant('App\\Service\\DOMJudgeService::EXTENSION_TO_MIMETYPE') %}
<img src="data:{{ EXTENSION_TO_MIMETYPE[run.imageType] }};base64,{{ runsOutput[runIdx].image_thumb | base64 }}"/>
<img class="image_thumb" src="data:{{ EXTENSION_TO_MIMETYPE[run.imageType] }};base64,{{ runsOutput[runIdx].image_thumb | base64 }}"/>
</a>
</span>
{% endif %}
Expand Down

0 comments on commit 1029abe

Please sign in to comment.