Skip to content

Commit

Permalink
Adjust for crop.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Sep 7, 2024
1 parent 00d0f4f commit 144449a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions classes/output/courseformat/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ public function export_for_template(\renderer_base $output) {
// Justification.
$data->gridjustification = $coursesettings['gridjustification'];

// Image resize is crop.
$data->imageresizemethodcrop = ($coursesettings['imageresizemethod'] == 2);

// Popup.
if (!$editing) {
$data->popup = false;
Expand Down
6 changes: 4 additions & 2 deletions templates/grid.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* sectionbreak - There is a section break for this section.
* sectionbreakheading - Section break heading.
* number - Section number.
* imageresizemethodcrop - Image resize method is crop.
* iscurrent - Current section?
* sectionurl - Section URL.
* sectionname - Section name.
Expand Down Expand Up @@ -61,6 +62,7 @@
"sectioncompletionmarkup": ""
}
],
"imageresizemethodcrop": true,
"showcompletion": true
}
}}
Expand Down Expand Up @@ -96,7 +98,7 @@
<div class="grid-image-container">
{{#imageuri}}
<div class="grid-image text-center">
<img class="card-img-bottom" src="{{imageuri}}" alt="{{imagealttext}}" loading="lazy">
<img{{#imageresizemethodcrop}} class="card-img-bottom" {{/imageresizemethodcrop}} src="{{imageuri}}" alt="{{imagealttext}}" loading="lazy">
{{#sectioncompletionmarkup}}{{{sectioncompletionmarkup}}}{{/sectioncompletionmarkup}}
</div>
{{/imageuri}}
Expand All @@ -106,7 +108,7 @@
</div>
{{/generatedimageuri}}
{{#imageerror}}
<div class="grid-image-error card-img-bottom text-center">
<div class="grid-image-error text-center">
<p><small>{{imageerror}}</small></p>
{{#sectioncompletionmarkup}}{{{sectioncompletionmarkup}}}{{/sectioncompletionmarkup}}
</div>
Expand Down

0 comments on commit 144449a

Please sign in to comment.