Skip to content

Commit dee9500

Browse files
committed
Use resized images in panel view
1 parent eadbfc6 commit dee9500

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

commands/generate.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ class AltTextGenerator
5555
public function __construct(CLI $cli)
5656
{
5757
$this->cli = $cli;
58-
58+
5959
// Use CLI prompt if provided, otherwise use config option
6060
$prompt = $cli->arg('prompt') ?: kirby()->option('medienbaecker.alter.prompt');
61-
61+
6262
$this->config = [
6363
'prompt' => $prompt,
6464
'overwrite' => $cli->arg('overwrite'),
@@ -428,7 +428,7 @@ private function generateAltText($image, $language = null): string
428428
throw new \Exception('Image file not found: ' . $image->root());
429429
}
430430

431-
$resized = $image->resize(500);
431+
$resized = $image->resize(500, 500);
432432
$resized->publish();
433433
$imageContent = $resized->read();
434434

@@ -441,12 +441,12 @@ private function generateAltText($image, $language = null): string
441441

442442
// Get prompt - handle callback if provided
443443
$prompt = $this->config['prompt'];
444-
444+
445445
// If prompt is callable, invoke it with the image
446446
if (is_callable($prompt)) {
447447
$prompt = $prompt($image);
448448
}
449-
449+
450450
// Add language specification to prompt
451451
if ($language) {
452452
$prompt .= ' Write the alt text in ' . $language->name() . '.';

index.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
$allImages[] = [
9494
'id' => $image->id(),
9595
'url' => $image->url(),
96+
'thumbUrl' => $image->resize(500, 500)->url(),
9697
'filename' => $image->filename(),
9798
'alt' => $altText,
9899
'alt_reviewed' => $image->alt_reviewed()->toBool(),

src/components/AlterView.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
</k-link>
3838
</k-text>
3939
<div class="page-group__badges">
40-
<k-button v-if="pageGroup.pageStatus === 'draft' || pageGroup.hasParentDrafts" element="span" variant="filled" size="sm"
41-
theme="negative">
40+
<k-button v-if="pageGroup.pageStatus === 'draft' || pageGroup.hasParentDrafts" element="span"
41+
variant="filled" size="sm" theme="negative">
4242
{{ $t('page.status.draft') }}
4343
</k-button>
4444
<k-button element="span" variant="filled" size="sm">
@@ -54,7 +54,8 @@
5454
<div v-for="image in pageGroup.images" :key="image.id"
5555
:class="{ 'alt-review-card--has-changes': currentImages[image.id] && hasChanges(image.id) }"
5656
class="alt-review-card">
57-
<k-image-frame :src="image.url" :alt="getImageData(image.id).alt" back="pattern" ratio="3/2" />
57+
<k-image-frame :src="image.thumbUrl" :alt="getImageData(image.id).alt" back="pattern"
58+
ratio="3/2" />
5859

5960
<div class="alt-review-card__content">
6061
<k-text class="alt-review-card__filename">
@@ -290,14 +291,14 @@ export default {
290291
// Alt text changed - update alt text count
291292
const hadAltText = original.alt && original.alt.trim() !== '';
292293
const hasAltText = current.alt && current.alt.trim() !== '';
293-
294+
294295
if (!hadAltText && hasAltText) {
295296
this.totals.withAltText++;
296297
} else if (hadAltText && !hasAltText) {
297298
this.totals.withAltText--;
298299
}
299300
}
300-
301+
301302
if (current.alt_reviewed !== original.alt_reviewed) {
302303
// Review status changed - update reviewed count
303304
if (current.alt_reviewed) {

0 commit comments

Comments
 (0)