Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor autogenerate feature #620

Conversation

kitzberger
Copy link
Contributor

@kitzberger kitzberger commented Jul 13, 2023

This feature allows to specify the 'variants' via TypoScript with the two parameters: factor and fileExtension

Example for CType image:

screenshot-api doppelherz de test_8080-2023 07 13-17_52_54

tt_content.image =< lib.contentElementWithHeader
tt_content.image {
    fields {
        content {
            fields {
                gallery = TEXT
                gallery {
                    dataProcessing {
                        10 = FriendsOfTYPO3\Headless\DataProcessing\FilesProcessor
                        10 {
                            references.fieldName = image
                            as = files
                            processingConfiguration {
                                delayProcessing = 1
                            }
                        }
                        20 = FriendsOfTYPO3\Headless\DataProcessing\GalleryProcessor
                        20 {
                            maxGalleryWidth = {$styles.content.textmedia.maxW}
                            ...
                            as = gallery
                            # Legacy options (internally migrated to new "formats" option)
                            autogenerate {
                                retina2x = 1
                                lqip = 0
                            }
                            formats {
                                publicUrl_webp {
                                    fileExtension = webp
                                    factor = 1.0
                                }
                                publicUrl_tinyJpg {
                                    fileExtension = jpg
                                    factor = 0.2
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Related: #617

@coveralls
Copy link

coveralls commented Jul 13, 2023

Pull Request Test Coverage Report for Build 8158417726

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 64.411%

Totals Coverage Status
Change from base Build 7816540853: 0.0%
Covered Lines: 847
Relevant Lines: 1315

💛 - Coveralls

@kitzberger
Copy link
Contributor Author

@twoldanski, what do you think of this approach? I'm thinking of renaming autogenerate to something more catchy, like maybe 'variants' or 'formats'?

@kitzberger kitzberger marked this pull request as ready for review July 14, 2023 13:34
@kitzberger kitzberger force-pushed the refactor-autogenerate-feature branch 2 times, most recently from 5f03c63 to 23cacee Compare July 17, 2023 10:25
@kitzberger kitzberger force-pushed the refactor-autogenerate-feature branch from 2be875a to 5c3853b Compare August 29, 2023 08:29
@kitzberger kitzberger marked this pull request as draft November 7, 2023 14:42
@kitzberger kitzberger marked this pull request as ready for review November 7, 2023 16:00
@kitzberger
Copy link
Contributor Author

I've added some documentation and taken the liberty to declare the old mechanic as deprecated because the new system is slightly better, I believe.

* Update docs on image processing
* Don't stretch image beyond its original dimensions
* Add workaround for legacy option 'autogenerate'
* Autogenerate images now configurable via TS
@kitzberger kitzberger force-pushed the refactor-autogenerate-feature branch from 641483d to e8b8195 Compare March 5, 2024 15:02
@twoldanski
Copy link
Collaborator

Thank for contribution! With larger refactor in #724 I back ported patch & tweak a bit your code, but functionally it is there.

@twoldanski twoldanski closed this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants