fix: reset cache for devices with different dimensions

This commit is contained in:
Benjamin Nussbaum 2025-05-13 14:05:12 +02:00
parent ad5ff5d2c9
commit 27ea7d1496
2 changed files with 21 additions and 0 deletions

View file

@ -115,4 +115,21 @@ class ImageGenerationService
}
}
}
public static function resetIfNotCacheable(?Plugin $plugin): void
{
if ($plugin?->id) {
if (
Device::query()
->where('width', '!=', 800)
->orWhere('height', '!=', 480)
->orWhere('rotate', '!=', 0)
->exists()
) {
// TODO cache image per device
$plugin->update(['current_image' => null]);
\Log::debug('Skip cache as devices with other dimensions exist');
}
}
}
}