Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jissereitsma committed Feb 27, 2024
1 parent 4a799cb commit e082931
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ A module `Foo_Bar` could add a `etc/di.xml` file to add a new convertor (a class
</config>
```

# FAQ
### Can I skip lazy loading of images?
Yes, just add `fetchpriority="high"` to the image HTML of your choice.

# Roadmap
- Move CLI into separate module
- Move frontend into separate module
Expand All @@ -32,7 +36,3 @@ A module `Foo_Bar` could add a `etc/di.xml` file to add a new convertor (a class
- AVIF
- JPEG XL
- WebP2
- Hyva compatibility
- Hyva\YireoNextGenImages\Plugin\UrlConvertorPlugin (`image\.(img|full|thumb|url`)
- Hyva\YireoNextGenImages\Plugin\ConverterPlugin (`img|full|thumb|url`)
- Hyva\YireoNextGenImages\Plugin\HtmlReplacerPlugin (`:src`): NOT NEEDED?
21 changes: 11 additions & 10 deletions view/frontend/templates/picture.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
use Yireo\NextGenImages\Block\Picture;

/** @var $block Picture */
$width = ($block->getWidth()) ? ' width="' . $block->getWidth() . '"' : '';
$height = ($block->getHeight()) ? ' height="' . $block->getHeight() . '"' : '';
$class = ($block->getClass()) ? ' class="' . $block->getClass() . '"' : '';
$width = ($block->getWidth()) ? ' width="'.$block->getWidth().'"' : '';
$height = ($block->getHeight()) ? ' height="'.$block->getHeight().'"' : '';
$class = ($block->getClass()) ? ' class="'.$block->getClass().'"' : '';
$lazyLoading = ($block->getLazyLoading()) ? ' loading="lazy" ' : '';

$originalTag = trim($block->getOriginalTag());
$originalTag = preg_replace('/(\/?)>$/', $lazyLoading . '\1>', $originalTag);
$originalTag = preg_replace('/(\/?)>$/', $lazyLoading.'\1>', $originalTag);

$originalImage = $block->getOriginalImage();
$originalImageType = $block->getOriginalImageType();
Expand All @@ -24,13 +24,14 @@ $srcSetAttribute = $srcAttribute.'set';

<picture<?= /* @noEscape */
$class ?>>
<!-- <?= $block->getOriginalAttributesAsString() ?> -->
<?php if ($block->getDebug()): ?>
<!-- <?= $block->getOriginalAttributesAsString() ?> -->
<?php endif; ?>
<?php foreach ($block->getImages() as $image): ?>
<source type="<?= /* @noEscape */
$image->getMimeType() ?>" <?= /* @noEscape */
$srcSetAttribute ?>="<?= /* @noEscape */
$image->getUrl() ?>" <?= /* @noEscape */
$block->getOriginalAttributesAsString() ?>>
<source type="<?= /* @noEscape */ $image->getMimeType() ?>"
<?= /* @noEscape */ $srcSetAttribute ?>="<?= /* @noEscape */ $image->getUrl() ?>"
<?= /* @noEscape */ $block->getOriginalAttributesAsString() ?>
>
<?php endforeach; ?>
<?= /* @noEscape */
$originalTag ?>
Expand Down

0 comments on commit e082931

Please sign in to comment.