craft-imageoptimize icon indicating copy to clipboard operation
craft-imageoptimize copied to clipboard

[Craft 4.0]: .srcsetWidth(size) does not return a variant of said size

Open JeanLucEsser opened this issue 2 years ago • 1 comments

Describe the bug

This works:

{{ optimizedImages.srcsetMinWidth(970) }}

Returns all variants of size over and including 970.

{{ optimizedImages.srcsetMaxWidth(970) }}

Returns all variants of size under and including 970.

This does not :

{{ optimizedImages.srcsetWidth(970) }}

Returns nothing (should return variant of size 970).

Versions

  • Plugin version: latest dev
  • Craft version: latest dev (4.x)

JeanLucEsser avatar Apr 21 '22 09:04 JeanLucEsser

I'm experiencing the same issue.

Image fields that used to output srcset (in Craft 3) with optimizedImages.srcsetWidthWebp(2000, true) now output an empty string ''.

Here's the field value dumped from various ImageOptimize methods:

image.one() (Craft asset)
 craft\elements\Asset#1
(
    [folderId] => 8
    [uploaderId] => 1
    [folderPath] => null
    [kind] => 'image'
    [alt] => null
    [size] => 5823332
    [keptFile] => null
    [dateModified] => DateTime#2
    (
        [date] => '2022-03-28 11:26:29.000000'
        [timezone_type] => 3
        [timezone] => 'America/Los_Angeles'
    )
    [newLocation] => null
    [locationError] => null
    [newFilename] => null
    [newFolderId] => null
    [tempFilePath] => null
    [avoidFilenameConflicts] => false
    [suggestedFilename] => null
    [conflictingFilename] => null
    [deletedWithVolume] => false
    [keepFileOnDelete] => false
    [craft\elements\Asset:_volumeId] => 6
    [craft\elements\Asset:_filename] => 'DJI_0270-cropped.jpg'
    [craft\elements\Asset:_width] => 3200
    [craft\elements\Asset:_height] => 2095
    [craft\elements\Asset:_focalPoint] => [
        'x' => 0.5018
        'y' => 0.768
    ]
    [craft\elements\Asset:_transform] => null
    [craft\elements\Asset:_volume] => craft\models\Volume#3
    (
        [id] => 6
        [name] => 'Hero'
        [handle] => 'hero'
        [titleTranslationMethod] => 'none'
        [titleTranslationKeyFormat] => null
        [sortOrder] => 6
        [fieldLayoutId] => 40
        [uid] => '80bfa1ff-9264-439f-86ba-497f4c5c46aa'
        [transformSubpath] => ''
        [craft\models\Volume:_fs] => vaersaagod\dospaces\Fs#4
        (
            [*:isVolumeLocal] => false
            [subfolder] => 'hero'
            [keyId] => '$DO_SPACES_ACCESS_KEY_ID'
            [secret] => '$DO_SPACES_SECRET_KEY'
            [endpoint] => '$DO_SPACES_ENDPOINT'
            [bucket] => '$DO_SPACES_BUCKET'
            [region] => '$DO_SPACES_REGION'
            [expires] => '1 years'
            [contentDisposition] => ''
            [*:foldersHaveTrailingSlashes] => true
            [yii\base\Model:_errors] => null
            [yii\base\Model:_validators] => null
            [yii\base\Model:_scenario] => 'default'
            [yii\base\Component:_events] => [
                'beforeValidate' => [
                    0 => [
                        0 => [
                            0 => craft\behaviors\EnvAttributeParserBehavior#5
                            (
                                [owner] => vaersaagod\dospaces\Fs#4(...)
                                [attributes] => [
                                    0 => 'subfolder'
                                    1 => 'keyId'
                                    2 => 'secret'
                                    3 => 'endpoint'
                                    4 => 'bucket'
                                    5 => 'region'
                                ]
                                [yii\base\Behavior:_attachedEvents] => [
                                    'beforeValidate' => 'beforeValidate'
                                    'afterValidate' => 'afterValidate'
                                ]
                            )
                            1 => 'beforeValidate'
                        ]
                        1 => null
                    ]
                ]
                'afterValidate' => [
                    0 => [
                        0 => [
                            0 => craft\behaviors\EnvAttributeParserBehavior#5(...)
                            1 => 'afterValidate'
                        ]
                        1 => null
                    ]
                ]
            ]
            [yii\base\Component:_eventWildcards] => []
            [yii\base\Component:_behaviors] => [
                'parser' => craft\behaviors\EnvAttributeParserBehavior#5(...)
            ]
            [id] => null
            [dateCreated] => null
            [dateUpdated] => null
            [name] => 'Hero'
            [handle] => 'hero'
            [oldHandle] => null
            [hasUrls] => true
            [url] => '$DO_SPACES_PUBLIC_URL'
            [uid] => null
        )
        [craft\models\Volume:_fsHandle] => 'hero'
        [craft\models\Volume:_transformFs] => null
        [craft\models\Volume:_transformFsHandle] => 'hero'
        [yii\base\Model:_errors] => null
        [yii\base\Model:_validators] => null
        [yii\base\Model:_scenario] => 'default'
        [yii\base\Component:_events] => []
        [yii\base\Component:_eventWildcards] => []
        [yii\base\Component:_behaviors] => [
            'fieldLayout' => craft\behaviors\FieldLayoutBehavior#6
            (
                [elementType] => 'craft\\elements\\Asset'
                [idAttribute] => 'fieldLayoutId'
                [craft\behaviors\FieldLayoutBehavior:_fieldLayoutId] => null
                [craft\behaviors\FieldLayoutBehavior:_fieldLayout] => null
                [owner] => craft\models\Volume#3(...)
                [yii\base\Behavior:_attachedEvents] => []
            )
        ]
    )
    [craft\elements\Asset:_uploader] => null
    [craft\elements\Asset:_oldVolumeId] => 6
    [*:revisionCreatorId] => null
    [*:revisionNotes] => null
    [craft\base\Element:_canonicalId] => null
    [craft\base\Element:_canonical] => null
    [craft\base\Element:_canonicalAnySite] => null
    [craft\base\Element:_canonicalUid] => null
    [craft\base\Element:_outdatedAttributes] => null
    [craft\base\Element:_modifiedAttributes] => null
    [craft\base\Element:_outdatedFields] => null
    [craft\base\Element:_modifiedFields] => null
    [craft\base\Element:_initialized] => true
    [craft\base\Element:_fieldsByHandle] => [
        'canonicalId' => null
        'isDraft' => null
        'isRevision' => null
        'isUnpublishedDraft' => null
        'ref' => null
        'status' => null
        'url' => null
        'extension' => null
        'filename' => null
        'focalPoint' => null
        'hasFocalPoint' => null
        'height' => null
        'mimeType' => null
        'path' => null
        'volumeId' => null
        'width' => null
        'ioHero' => nystudio107\imageoptimize\fields\OptimizedImages#7
        (
            [fieldVolumeSettings] => [
                'hero' => '*'
                'stories' => '*'
            ]
            [ignoreFilesOfType] => []
            [displayOptimizedImageVariants] => true
            [displayDominantColorPalette] => true
            [displayLazyLoadPlaceholderImages] => true
            [variants] => [
                0 => [
                    'width' => '2000'
                    'useAspectRatio' => '1'
                    'aspectRatioX' => '16'
                    'aspectRatioY' => '9'
                    'retinaSizes' => [
                        0 => '1'
                        1 => '2'
                    ]
                    'quality' => '82'
                    'format' => 'jpg'
                ]
                1 => [
                    'width' => '1536'
                    'useAspectRatio' => '1'
                    'aspectRatioX' => '16'
                    'aspectRatioY' => '9'
                    'retinaSizes' => [
                        0 => '1'
                        1 => '2'
                    ]
                    'quality' => '82'
                    'format' => 'jpg'
                ]
                2 => [
                    'width' => '1279'
                    'useAspectRatio' => '1'
                    'aspectRatioX' => '16'
                    'aspectRatioY' => '9'
                    'retinaSizes' => [
                        0 => '1'
                        1 => '2'
                    ]
                    'quality' => '82'
                    'format' => 'jpg'
                ]
                3 => [
                    'width' => '1023'
                    'useAspectRatio' => '1'
                    'aspectRatioX' => '8'
                    'aspectRatioY' => '5'
                    'retinaSizes' => [
                        0 => '1'
                        1 => '2'
                    ]
                    'quality' => '82'
                    'format' => 'jpg'
                ]
                4 => [
                    'width' => '767'
                    'useAspectRatio' => '1'
                    'aspectRatioX' => '5'
                    'aspectRatioY' => '4'
                    'retinaSizes' => [
                        0 => '1'
                        1 => '2'
                    ]
                    'quality' => '60'
                    'format' => 'jpg'
                ]
                5 => [
                    'width' => '639'
                    'useAspectRatio' => '1'
                    'aspectRatioX' => '5'
                    'aspectRatioY' => '8'
                    'retinaSizes' => [
                        0 => '1'
                        1 => '2'
                    ]
                    'quality' => '60'
                    'format' => 'jpg'
                ]
            ]
            [nystudio107\imageoptimize\fields\OptimizedImages:aspectRatios] => [
                0 => [
                    'x' => 16
                    'y' => 9
                ]
                1 => [
                    'x' => 8
                    'y' => 5
                ]
                2 => [
                    'x' => 4
                    'y' => 3
                ]
                3 => [
                    'x' => 5
                    'y' => 4
                ]
                4 => [
                    'x' => 1
                    'y' => 1
                ]
                5 => [
                    'x' => 9
                    'y' => 16
                ]
                6 => [
                    'x' => 5
                    'y' => 8
                ]
                7 => [
                    'x' => 3
                    'y' => 4
                ]
                8 => [
                    'x' => 4
                    'y' => 5
                ]
            ]
            [craft\base\Field:_isFresh] => null
            [yii\base\Model:_errors] => null
            [yii\base\Model:_validators] => null
            [yii\base\Model:_scenario] => 'default'
            [yii\base\Component:_events] => []
            [yii\base\Component:_eventWildcards] => []
            [yii\base\Component:_behaviors] => []
            [id] => '88'
            [dateCreated] => DateTime#8
            (
                [date] => '2021-08-04 15:11:26.000000'
                [timezone_type] => 3
                [timezone] => 'America/Los_Angeles'
            )
            [dateUpdated] => DateTime#9
            (
                [date] => '2021-09-10 22:48:04.000000'
                [timezone_type] => 3
                [timezone] => 'America/Los_Angeles'
            )
            [groupId] => 3
            [name] => 'IO Hero'
            [handle] => 'ioHero'
            [context] => 'global'
            [instructions] => null
            [searchable] => false
            [describedBy] => null
            [translationMethod] => 'none'
            [translationKeyFormat] => null
            [oldHandle] => null
            [oldSettings] => null
            [columnPrefix] => null
            [columnSuffix] => 'vaketuxg'
            [uid] => 'ffe5389b-485f-4142-9697-a54ad6b0ae70'
            [layoutId] => null
            [tabId] => null
            [required] => false
            [sortOrder] => null
        )
    ]
    [craft\base\Element:_fieldParamNamePrefix] => null
    [craft\base\Element:_normalizedFieldValues] => [
        'ioHero' => true
    ]
    [craft\base\Element:_allDirty] => false
    [craft\base\Element:_dirtyAttributes] => []
    [craft\base\Element:_savedTitle] => 'DJI 0270 cropped'
    [craft\base\Element:_dirtyFields] => []
    [craft\base\Element:_nextElement] => false
    [craft\base\Element:_prevElement] => false
    [craft\base\Element:_parentId] => null
    [craft\base\Element:_parent] => null
    [craft\base\Element:_hasNewParent] => null
    [craft\base\Element:_prevSibling] => null
    [craft\base\Element:_nextSibling] => null
    [craft\base\Element:_eagerLoadedElements] => []
    [craft\base\Element:_eagerLoadedElementCounts] => []
    [craft\base\Element:_currentRevision] => null
    [craft\base\Element:_enabledForSite] => true
    [craft\base\Element:_uiLabel] => null
    [craft\base\Element:_isFresh] => null
    [yii\base\Model:_errors] => null
    [yii\base\Model:_validators] => null
    [yii\base\Model:_scenario] => 'default'
    [yii\base\Component:_events] => []
    [yii\base\Component:_eventWildcards] => []
    [yii\base\Component:_behaviors] => [
        'customFields' => craft\behaviors\CustomFieldBehavior#10
        (
            [hasMethods] => false
            [canSetProperties] => false
            [homeIntro] => null
            [body] => null
            [image] => null
            [contact] => null
            [ioIntro] => null
            [ioHomeHero] => null
            [homeHero] => null
            [heroHeadline] => null
            [overline] => null
            [line] => null
            [brightness] => '75'
            [ioUniSection] => null
            [uniSection] => null
            [sectionTitle] => null
            [headline] => null
            [button] => null
            [emailAddress] => null
            [form] => null
            [fade] => null
            [ctaNewsletter] => null
            [ctaMember] => null
            [homeAbout] => null
            [homeStories] => null
            [galleryBlocks] => null
            [landscape] => null
            [portraitOne] => null
            [portraitTwo] => null
            [ioGalleryPortrait] => null
            [ioGalleryLandscape] => null
            [hero] => null
            [images] => null
            [intro] => null
            [sectionHeadline] => null
            [ioHero] => nystudio107\imageoptimize\models\OptimizedImage#11
            (
                [optimizedImageUrls] => [
                    2000 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2000x1125_crop_center-center_82_line/DJI_0270-cropped.jpg'
                    4000 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_4000x2250_crop_center-center_61_line/DJI_0270-cropped.jpg'
                    1536 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1536x864_crop_center-center_82_line/DJI_0270-cropped.jpg'
                    3072 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_3072x1728_crop_center-center_61_line/DJI_0270-cropped.jpg'
                    1279 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1279x719_crop_center-center_82_line/DJI_0270-cropped.jpg'
                    2558 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2558x1438_crop_center-center_61_line/DJI_0270-cropped.jpg'
                    1023 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1023x639_crop_center-center_82_line/DJI_0270-cropped.jpg'
                    2046 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2046x1278_crop_center-center_61_line/DJI_0270-cropped.jpg'
                    767 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_767x613_crop_center-center_60_line/DJI_0270-cropped.jpg'
                    1534 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1534x1227_crop_center-center_45_line/DJI_0270-cropped.jpg'
                    639 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_639x1022_crop_center-center_60_line/DJI_0270-cropped.jpg'
                    1278 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1278x2044_crop_center-center_45_line/DJI_0270-cropped.jpg'
                ]
                [optimizedWebPImageUrls] => [
                    2000 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2000x1125_crop_center-center_82_line/DJI_0270-cropped.jpg.webp'
                    4000 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_4000x2250_crop_center-center_61_line/DJI_0270-cropped.jpg.webp'
                    1536 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1536x864_crop_center-center_82_line/DJI_0270-cropped.jpg.webp'
                    3072 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_3072x1728_crop_center-center_61_line/DJI_0270-cropped.jpg.webp'
                    1279 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1279x719_crop_center-center_82_line/DJI_0270-cropped.jpg.webp'
                    2558 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2558x1438_crop_center-center_61_line/DJI_0270-cropped.jpg.webp'
                    1023 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1023x639_crop_center-center_82_line/DJI_0270-cropped.jpg.webp'
                    2046 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2046x1278_crop_center-center_61_line/DJI_0270-cropped.jpg.webp'
                    767 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_767x613_crop_center-center_60_line/DJI_0270-cropped.jpg.webp'
                    1534 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1534x1227_crop_center-center_45_line/DJI_0270-cropped.jpg.webp'
                    639 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_639x1022_crop_center-center_60_line/DJI_0270-cropped.jpg.webp'
                    1278 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1278x2044_crop_center-center_45_line/DJI_0270-cropped.jpg.webp'
                ]
                [variantSourceWidths] => [
                    0 => '2000'
                    1 => '2000'
                    2 => '1536'
                    3 => '1536'
                    4 => '1279'
                    5 => '1279'
                    6 => '1023'
                    7 => '1023'
                    8 => '767'
                    9 => '767'
                    10 => '639'
                    11 => '639'
                ]
                [variantHeights] => [
                    2000 => 1125
                    4000 => 2250
                    1536 => 864
                    3072 => 1728
                    1279 => 719
                    2558 => 1438
                    1023 => 639
                    2046 => 1278
                    767 => 613
                    1534 => 1227
                    639 => 1022
                    1278 => 2044
                ]
                [focalPoint] => [
                    'x' => 0.5018
                    'y' => 0.768
                ]
                [originalImageWidth] => 3200
                [originalImageHeight] => 2095
                [placeholder] => '/9j/4AAQSkZJRgABAQEAlgCWAAD/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCAAJABADAREAAhEBAxEB/8QAFwAAAwEAAAAAAAAAAAAAAAAAAgMEBf/EACAQAAAGAAcAAAAAAAAAAAAAAAABAgMRIQQFFTEzYXL/xAAZAQACAwEAAAAAAAAAAAAAAAABAgADBAX/xAAaEQADAAMBAAAAAAAAAAAAAAAAAQIDMUFR/9oADAMBAAIRAxEAPwBuq3BN36HOmqWmaW5fA1Zi5FNpnsMs9rojmfDIwfIYDDJS9ukVsjP/2Q=='
                [placeholderSvg] => ''
                [colorPalette] => [
                    0 => '#857525'
                    1 => '#a8b7b9'
                    2 => '#d9a35f'
                    3 => '#3b2f07'
                    4 => '#593a08'
                ]
                [lightness] => 44
                [placeholderWidth] => 2000
                [placeholderHeight] => 1125
                [stickyErrors] => []
                [yii\base\Model:_errors] => null
                [yii\base\Model:_validators] => null
                [yii\base\Model:_scenario] => 'default'
                [yii\base\Component:_events] => []
                [yii\base\Component:_eventWildcards] => []
                [yii\base\Component:_behaviors] => []
            )
            [vineyards] => null
            [teamIntro] => null
            [teamMembers] => null
            [cards] => null
            [blurb] => null
            [ioTeamMembers] => null
            [allocationCalendar] => null
            [allocationsCards] => null
            [allocationsIntro] => null
            [bottleShot] => null
            [customizeClub] => null
            [customizeClubHeadline] => null
            [customizeClubPhoto] => null
            [customizeClubPricingGrid] => null
            [ioBottleShots] => null
            [ioComposerFullWidth] => null
            [ioVintageStory] => null
            [wineInformation] => null
            [april] => null
            [june] => null
            [january] => null
            [may] => null
            [february] => null
            [july] => null
            [october] => null
            [september] => null
            [december] => null
            [march] => null
            [november] => null
            [august] => null
            [clubTypes] => null
            [selection] => null
            [buttons] => null
            [clubType] => null
            [wines] => null
            [clubLabel] => null
            [left] => null
            [buttonLabel] => null
            [buttonValue] => null
            [selectionValue] => null
            [selectionName] => null
            [benefits] => null
            [drinkability] => null
            [labeledAppellation] => null
            [alcohol] => null
            [tastingNotes] => null
            [varietalComposition] => null
            [tradeMaterials] => null
            [vinification] => null
            [casesProduced] => null
            [asset] => null
            [awardsAccolades] => null
            [quoteBlocks] => null
            [quoteAuthor] => null
            [quoteBody] => null
            [backgroundImage] => null
            [faqs] => null
            [question] => null
            [answer] => null
            [finePrint] => null
            [relatedWines] => null
            [vintageStory] => null
            [storyBlocks] => null
            [blockBody] => null
            [blockImage] => null
            [pairingRecommendation] => null
            [location] => null
            [hours] => null
            [latlng] => null
            [postalCode] => null
            [state] => null
            [street] => null
            [city] => null
            [email] => null
            [telephone] => null
            [reservations] => null
            [scriptSrc] => null
            [notes] => null
            [purchase] => null
            [pricePerBottle] => null
            [available] => null
            [unavailableWineInfo] => null
            [message] => null
            [composer] => null
            [caption] => null
            [quote] => null
            [attribution] => null
            [ioStoriesFeatured] => null
            [ioStoriesThumb] => null
            [featuredEvent] => null
            [featuredPost] => null
            [articleCount] => null
            [brandMaterialsGroups] => null
            [distributorGroups] => null
            [ioTradeMediaThumb] => null
            [photoGroups] => null
            [regionDistributorsTable] => null
            [regionTitle] => null
            [assetDownloads] => null
            [groupTitle] => null
            [vintages] => null
            [wineName] => null
            [photos] => null
            [distributor] => null
            [websiteLink] => null
            [phone] => null
            [techSheet] => null
            [vintageYear] => null
            [shelfTalker] => null
            [frontBackLabel] => null
            [storyThumbnail] => null
            [storyHero] => null
            [excerpt] => null
            [ioComposerImage] => null
            [ioComposerGalleryThumbnail] => null
            [ioComposerGalleryUp] => null
            [donationForm] => null
            [firstName] => null
            [lastName] => null
            [organizationNameAuction] => null
            [organizationAddress] => null
            [dateOfEvent] => null
            [eventBeneficiary] => null
            [eventLetter] => null
            [irsLetterFor501cStatus] => null
            [procurementFormIfAvailable] => null
            [areYouAWineClubMember] => null
            [organizationType1] => null
            [altText] => 'Red Mountain Vineyard'
            [customizeClubPricingNotes] => null
            [year] => null
            [label] => null
            [ioSimpleSection] => null
            [specialNotice] => null
            [homeMembership] => null
            [right] => null
            [dates] => null
            [endDate] => null
            [startDate] => null
            [textButton] => null
            [date] => null
            [logo] => null
            [articleUrl] => null
            [sideNav] => null
            [navLink] => null
            [linkTo] => null
            [mailingListHero] => null
            [heading] => null
            [subheading] => null
            [craft\behaviors\CustomFieldBehavior:_customFieldValues] => []
            [owner] => craft\elements\Asset#1(...)
            [yii\base\Behavior:_attachedEvents] => []
        )
    ]
    [id] => 56728
    [tempId] => null
    [draftId] => null
    [revisionId] => null
    [isProvisionalDraft] => false
    [uid] => 'a034c1a2-d231-49bc-8fbd-c549283d5977'
    [siteSettingsId] => 59135
    [fieldLayoutId] => 40
    [structureId] => null
    [contentId] => 4929
    [enabled] => true
    [archived] => false
    [siteId] => 1
    [title] => 'DJI 0270 cropped'
    [slug] => null
    [uri] => null
    [dateCreated] => DateTime#12
    (
        [date] => '2022-03-28 11:26:28.000000'
        [timezone_type] => 3
        [timezone] => 'America/Los_Angeles'
    )
    [dateUpdated] => DateTime#13
    (
        [date] => '2022-05-08 19:39:16.000000'
        [timezone_type] => 3
        [timezone] => 'America/Los_Angeles'
    )
    [dateLastMerged] => null
    [dateDeleted] => null
    [root] => null
    [lft] => null
    [rgt] => null
    [level] => null
    [searchScore] => null
    [trashed] => false
    [awaitingFieldValues] => false
    [propagating] => false
    [propagateAll] => false
    [newSiteIds] => []
    [isNewForSite] => false
    [resaving] => false
    [duplicateOf] => null
    [firstSave] => false
    [mergingCanonicalChanges] => false
    [updatingFromDerivative] => false
    [previewing] => false
    [hardDelete] => false
) 
image.one().ioHero(ImageOptimize values)
 nystudio107\imageoptimize\models\OptimizedImage#1
(
    [optimizedImageUrls] => [
        2000 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2000x1125_crop_center-center_82_line/DJI_0270-cropped.jpg'
        4000 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_4000x2250_crop_center-center_61_line/DJI_0270-cropped.jpg'
        1536 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1536x864_crop_center-center_82_line/DJI_0270-cropped.jpg'
        3072 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_3072x1728_crop_center-center_61_line/DJI_0270-cropped.jpg'
        1279 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1279x719_crop_center-center_82_line/DJI_0270-cropped.jpg'
        2558 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2558x1438_crop_center-center_61_line/DJI_0270-cropped.jpg'
        1023 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1023x639_crop_center-center_82_line/DJI_0270-cropped.jpg'
        2046 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2046x1278_crop_center-center_61_line/DJI_0270-cropped.jpg'
        767 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_767x613_crop_center-center_60_line/DJI_0270-cropped.jpg'
        1534 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1534x1227_crop_center-center_45_line/DJI_0270-cropped.jpg'
        639 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_639x1022_crop_center-center_60_line/DJI_0270-cropped.jpg'
        1278 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1278x2044_crop_center-center_45_line/DJI_0270-cropped.jpg'
    ]
    [optimizedWebPImageUrls] => [
        2000 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2000x1125_crop_center-center_82_line/DJI_0270-cropped.jpg.webp'
        4000 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_4000x2250_crop_center-center_61_line/DJI_0270-cropped.jpg.webp'
        1536 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1536x864_crop_center-center_82_line/DJI_0270-cropped.jpg.webp'
        3072 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_3072x1728_crop_center-center_61_line/DJI_0270-cropped.jpg.webp'
        1279 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1279x719_crop_center-center_82_line/DJI_0270-cropped.jpg.webp'
        2558 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2558x1438_crop_center-center_61_line/DJI_0270-cropped.jpg.webp'
        1023 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1023x639_crop_center-center_82_line/DJI_0270-cropped.jpg.webp'
        2046 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_2046x1278_crop_center-center_61_line/DJI_0270-cropped.jpg.webp'
        767 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_767x613_crop_center-center_60_line/DJI_0270-cropped.jpg.webp'
        1534 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1534x1227_crop_center-center_45_line/DJI_0270-cropped.jpg.webp'
        639 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_639x1022_crop_center-center_60_line/DJI_0270-cropped.jpg.webp'
        1278 => 'https://my-project.sfo3.digitaloceanspaces.com/hero/_1278x2044_crop_center-center_45_line/DJI_0270-cropped.jpg.webp'
    ]
    [variantSourceWidths] => [
        0 => '2000'
        1 => '2000'
        2 => '1536'
        3 => '1536'
        4 => '1279'
        5 => '1279'
        6 => '1023'
        7 => '1023'
        8 => '767'
        9 => '767'
        10 => '639'
        11 => '639'
    ]
    [variantHeights] => [
        2000 => 1125
        4000 => 2250
        1536 => 864
        3072 => 1728
        1279 => 719
        2558 => 1438
        1023 => 639
        2046 => 1278
        767 => 613
        1534 => 1227
        639 => 1022
        1278 => 2044
    ]
    [focalPoint] => [
        'x' => 0.5018
        'y' => 0.768
    ]
    [originalImageWidth] => 3200
    [originalImageHeight] => 2095
    [placeholder] => '/9j/4AAQSkZJRgABAQEAlgCWAAD/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCAAJABADAREAAhEBAxEB/8QAFwAAAwEAAAAAAAAAAAAAAAAAAgMEBf/EACAQAAAGAAcAAAAAAAAAAAAAAAABAgMRIQQFFTEzYXL/xAAZAQACAwEAAAAAAAAAAAAAAAABAgADBAX/xAAaEQADAAMBAAAAAAAAAAAAAAAAAQIDMUFR/9oADAMBAAIRAxEAPwBuq3BN36HOmqWmaW5fA1Zi5FNpnsMs9rojmfDIwfIYDDJS9ukVsjP/2Q=='
    [placeholderSvg] => ''
    [colorPalette] => [
        0 => '#857525'
        1 => '#a8b7b9'
        2 => '#d9a35f'
        3 => '#3b2f07'
        4 => '#593a08'
    ]
    [lightness] => 44
    [placeholderWidth] => 2000
    [placeholderHeight] => 1125
    [stickyErrors] => []
    [yii\base\Model:_errors] => null
    [yii\base\Model:_validators] => null
    [yii\base\Model:_scenario] => 'default'
    [yii\base\Component:_events] => []
    [yii\base\Component:_eventWildcards] => []
    [yii\base\Component:_behaviors] => null
) 
image.one().ioHero.src
'https://my-project.sfo3.digitaloceanspaces.com/hero/_2000x1125_crop_center-center_82_line/DJI_0270-cropped.jpg'
image.one().ioHero.srcset
'https://my-project.sfo3.digitaloceanspaces.com/hero/_2000x1125_crop_center-center_82_line/DJI_0270-cropped.jpg 2000w, https://my-project.sfo3.digitaloceanspaces.com/hero/_4000x2250_crop_center-center_61_line/DJI_0270-cropped.jpg 4000w, https://my-project.sfo3.digitaloceanspaces.com/hero/_1536x864_crop_center-center_82_line/DJI_0270-cropped.jpg 1536w, https://my-project.sfo3.digitaloceanspaces.com/hero/_3072x1728_crop_center-center_61_line/DJI_0270-cropped.jpg 3072w, https://my-project.sfo3.digitaloceanspaces.com/hero/_1279x719_crop_center-center_82_line/DJI_0270-cropped.jpg 1279w, https://my-project.sfo3.digitaloceanspaces.com/hero/_2558x1438_crop_center-center_61_line/DJI_0270-cropped.jpg 2558w, https://my-project.sfo3.digitaloceanspaces.com/hero/_1023x639_crop_center-center_82_line/DJI_0270-cropped.jpg 1023w, https://my-project.sfo3.digitaloceanspaces.com/hero/_2046x1278_crop_center-center_61_line/DJI_0270-cropped.jpg 2046w, https://my-project.sfo3.digitaloceanspaces.com/hero/_767x613_crop_center-center_60_line/DJI_0270-cropped.jpg 767w, https://my-project.sfo3.digitaloceanspaces.com/hero/_1534x1227_crop_center-center_45_line/DJI_0270-cropped.jpg 1534w, https://my-project.sfo3.digitaloceanspaces.com/hero/_639x1022_crop_center-center_60_line/DJI_0270-cropped.jpg 639w, https://my-project.sfo3.digitaloceanspaces.com/hero/_1278x2044_crop_center-center_45_line/DJI_0270-cropped.jpg 1278w'
image.one().ioHero.srcsetMinWidth(1152)
'https://my-project.sfo3.digitaloceanspaces.com/hero/_2000x1125_crop_center-center_82_line/DJI_0270-cropped.jpg 2000w, https://my-project.sfo3.digitaloceanspaces.com/hero/_4000x2250_crop_center-center_61_line/DJI_0270-cropped.jpg 4000w, https://my-project.sfo3.digitaloceanspaces.com/hero/_1536x864_crop_center-center_82_line/DJI_0270-cropped.jpg 1536w, https://my-project.sfo3.digitaloceanspaces.com/hero/_3072x1728_crop_center-center_61_line/DJI_0270-cropped.jpg 3072w, https://my-project.sfo3.digitaloceanspaces.com/hero/_1279x719_crop_center-center_82_line/DJI_0270-cropped.jpg 1279w, https://my-project.sfo3.digitaloceanspaces.com/hero/_2558x1438_crop_center-center_61_line/DJI_0270-cropped.jpg 2558w'
image.one().ioHero.srcsetWidth(1152)
''
image.one().ioHero.srcsetWidthWebp(2000, true)
''

Let me know if you need any more info!

Craft v4.0.1 ImageOptimize v4.0.0-beta.3

lukastransom avatar May 09 '22 05:05 lukastransom

Addressed in: https://github.com/nystudio107/craft-imageoptimize/commit/de3d02da4e2fa751d83d3672fbe977968e8b8ea9

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-imageoptimize": "dev-develop-v4 as 4.0.3”,

Then do a composer clear-cache && composer update

khalwat avatar Nov 15 '22 22:11 khalwat