Krita.php 710 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OC\Preview;
  7. use OCP\Files\File;
  8. use OCP\IImage;
  9. class Krita extends Bundled {
  10. /**
  11. * {@inheritDoc}
  12. */
  13. public function getMimeType(): string {
  14. return '/application\/x-krita/';
  15. }
  16. /**
  17. * @inheritDoc
  18. */
  19. public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage {
  20. $image = $this->extractThumbnail($file, 'mergedimage.png');
  21. if (($image !== null) && $image->valid()) {
  22. return $image;
  23. }
  24. $image = $this->extractThumbnail($file, 'preview.png');
  25. if (($image !== null) && $image->valid()) {
  26. return $image;
  27. }
  28. return null;
  29. }
  30. }