Skip to content

Commit 1029abe

Browse files
committed
Force max thumbnail size in CSS to scale down SVGs
1 parent 540ce7c commit 1029abe

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

webapp/src/Controller/Jury/SubmissionController.php

+1
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ public function viewAction(
581581
'requestedOutputCount' => $requestedOutputCount,
582582
'version_warnings' => [],
583583
'isMultiPassProblem' => $submission->getProblem()->isMultipassProblem(),
584+
'thumbnailSize' => $this->config->get('thumbnail_size'),
584585
];
585586

586587
if ($selectedJudging === null) {

webapp/src/Controller/Team/SubmissionController.php

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ public function viewAction(Request $request, int $submitId): Response
200200
'showSampleOutput' => $showSampleOutput,
201201
'runs' => $runs,
202202
'showTooLateResult' => $showTooLateResult,
203+
'thumbnailSize' => $this->config->get('thumbnail_size'),
203204
];
204205
if ($actuallyShowCompile) {
205206
$data['size'] = 'xl';

webapp/templates/jury/submission.html.twig

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
.judging-table tr.disabled td a {
2020
color: silver
2121
}
22+
23+
.image_thumb {
24+
max-width: {{ thumbnailSize }}px;
25+
max-height: {{ thumbnailSize }}px;
26+
}
2227
</style>
2328
{% endblock %}
2429
@@ -743,7 +748,7 @@
743748
{% set imgUrl = path('jury_problem_testcase_fetch', {'probId': submission.problem.probid, 'rank': run.rank, 'type': 'image'}) %}
744749
<a href="{{ imgUrl }}">
745750
{% set EXTENSION_TO_MIMETYPE = constant('App\\Service\\DOMJudgeService::EXTENSION_TO_MIMETYPE') %}
746-
<img src="data:{{ EXTENSION_TO_MIMETYPE[run.imageType] }};base64,{{ runsOutput[runIdx].image_thumb | base64 }}"/>
751+
<img class="image_thumb" src="data:{{ EXTENSION_TO_MIMETYPE[run.imageType] }};base64,{{ runsOutput[runIdx].image_thumb | base64 }}"/>
747752
</a>
748753
</span>
749754
{% endif %}

0 commit comments

Comments
 (0)