StaticImageMedium.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * @package Grav\Common\Page
  4. *
  5. * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
  6. * @license MIT License; see LICENSE file for details.
  7. */
  8. namespace Grav\Common\Page\Medium;
  9. use Grav\Common\Media\Interfaces\ImageMediaInterface;
  10. use Grav\Common\Media\Traits\ImageLoadingTrait;
  11. use Grav\Common\Media\Traits\StaticResizeTrait;
  12. /**
  13. * Class StaticImageMedium
  14. * @package Grav\Common\Page\Medium
  15. */
  16. class StaticImageMedium extends Medium implements ImageMediaInterface
  17. {
  18. use StaticResizeTrait;
  19. use ImageLoadingTrait;
  20. /**
  21. * Parsedown element for source display mode
  22. *
  23. * @param array $attributes
  24. * @param bool $reset
  25. * @return array
  26. */
  27. protected function sourceParsedownElement(array $attributes, $reset = true)
  28. {
  29. if (empty($attributes['src'])) {
  30. $attributes['src'] = $this->url($reset);
  31. }
  32. return ['name' => 'img', 'attributes' => $attributes];
  33. }
  34. /**
  35. * @return $this
  36. */
  37. public function higherQualityAlternative()
  38. {
  39. return $this;
  40. }
  41. }