-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from justbetter/feature/wip-features
Added attribute bag + option for sources in config
- Loading branch information
Showing
5 changed files
with
156 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
<?php | ||
|
||
return [ | ||
// Make use of the placeholder image which is generated from a glide data url. | ||
// This will add a blurry image as a placeholder before loading the correct size. | ||
'placeholder' => true, | ||
|
||
// The default presets used for generating the resizes. | ||
// If the config in statamic.assets.image_manipulation.presets is empty this will be used instead. | ||
'presets' => [ | ||
'placeholder' => ['w' => 32, 'h' => 32, 'q' => 100, 'fit' => 'crop'], | ||
'xs' => ['w' => 320, 'h' => 320, 'q' => 100, 'fit' => 'crop'], | ||
'sm' => ['w' => 480, 'h' => 480, 'q' => 100, 'fit' => 'crop'], | ||
'md' => ['w' => 768, 'h' => 768, 'q' => 100, 'fit' => 'crop'], | ||
'lg' => ['w' => 1280, 'h' => 1280, 'q' => 100, 'fit' => 'crop'], | ||
'xl' => ['w' => 1440, 'h' => 1440, 'q' => 100, 'fit' => 'crop'], | ||
'2xl' => ['w' => 1680, 'h' => 1680, 'q' => 100, 'fit' => 'crop'], | ||
'placeholder' => ['w' => 32, 'h' => 32, 'q' => 100, 'fit' => 'crop_focal'], | ||
'xs' => ['w' => 320, 'h' => 320, 'q' => 100, 'fit' => 'crop_focal'], | ||
'sm' => ['w' => 480, 'h' => 480, 'q' => 100, 'fit' => 'crop_focal'], | ||
'md' => ['w' => 768, 'h' => 768, 'q' => 100, 'fit' => 'crop_focal'], | ||
'lg' => ['w' => 1280, 'h' => 1280, 'q' => 100, 'fit' => 'crop_focal'], | ||
'xl' => ['w' => 1440, 'h' => 1440, 'q' => 100, 'fit' => 'crop_focal'], | ||
'2xl' => ['w' => 1680, 'h' => 1680, 'q' => 100, 'fit' => 'crop_focal'], | ||
|
||
'xs-h' => ['w' => 160, 'h' => 320, 'q' => 100, 'fit' => 'crop_focal'], | ||
'sm-h' => ['w' => 320, 'h' => 480, 'q' => 100, 'fit' => 'crop_focal'], | ||
'md-h' => ['w' => 480, 'h' => 768, 'q' => 100, 'fit' => 'crop_focal'], | ||
'lg-h' => ['w' => 768, 'h' => 1280, 'q' => 100, 'fit' => 'crop_focal'], | ||
'xl-h' => ['w' => 1280, 'h' => 1440, 'q' => 100, 'fit' => 'crop_focal'], | ||
'2xl-h' => ['w' => 1440, 'h' => 1680, 'q' => 100, 'fit' => 'crop_focal'], | ||
], | ||
]; | ||
|
||
// Configure which sources you would like to use. | ||
// Set 'webp' for WebP only. | ||
// Set 'mime_type' for the original image mime type. | ||
// Set 'both' to use both sources. | ||
'sources' => 'webp' | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
<script> | ||
window.responsiveResizeObserver = new ResizeObserver((entries) => { | ||
console.log('test') | ||
entries.forEach(entry => { | ||
const imgWidth = entry.target.getBoundingClientRect().width; | ||
const imgHeight = entry.target.getBoundingClientRect().height; | ||
const pixelRatio = window.devicePixelRatio * imgWidth; | ||
entry.target.parentNode.querySelectorAll('source').forEach((source) => { | ||
source.sizes = imgWidth + 'px'; | ||
source.sizes = pixelRatio + 'px'; | ||
}); | ||
}); | ||
}); | ||
</script> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters