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

Glide process image assets on upload #6040

Merged
merged 69 commits into from
Jan 10, 2023
Merged

Conversation

jesseleite
Copy link
Member

@jesseleite jesseleite commented May 13, 2022

Closes statamic/ideas#485
Closes statamic/ideas#804
References statamic/ideas#300

  • Add new glide config to asset container edit form.
    image (20)
    • Wire up new glide_source_preset config.
      • Glide process images on upload.
      • Fix error when uploading non-glideable filetypes.
      • Hook up mark watermarking.
      • Add test coverage.
    • Wire up new glide_warm_presets config.
      • Ensure user can save glide_warm_presets: false to disable intelligent warming.
      • Glide configured warm presets on upload.
      • Glide intelligently on upload when warm presets are not configured (everything except glide_source_preset).
      • Glide configured warm presets when running pls glide:generate-presets.
      • Add test coverage.
    • Add new translatable strings to translation files.
    • Documentation PR.

jesseleite and others added 29 commits May 13, 2022 15:57
@jesseleite jesseleite changed the base branch from 3.3 to master May 31, 2022 14:59
@jackmcdade jackmcdade added this to the 3.4 milestone Jan 4, 2023
@what-the-diff
Copy link

what-the-diff bot commented Jan 4, 2023

  • Added source_preset and warm_presets to asset container config.
  • Updated the uploader component in CP to use these new settings, if present on a given container.
  • Refactored some of the file uploading logic into an AssetUploader class that can be used by other parts of Statamic (e.g., File Upload fieldtype). This is similar to how we have FieldsetBlueprintLoader for blueprints, but it's not quite as generic because there are still some assumptions about where files will end up being uploaded from/to based on whether or not they're assets vs just regular files being uploaded via a form submission somewhere else in Statamic (like with forms addon). I'm open to suggestions here! :)
  • Added source_preset and warm_presets to asset container config
  • Updated the AssetContainersController with new fields for these settings
  • Updated GlideManager::server() method to accept an array of overrides, so we can pass in a custom cache path when processing images from assets that have their own preset defined (ie: not using the default)
  • Added a few new config options to AssetContainer
  • Updated the asset upload process to use those configs if they're set
  • Created tests for all of that stuff, including some Glide integration testing (which is why I added define-env)

…ded cases. Prevents the uploaded file being missing on subsequent tests.
- container ignoredPresets swapped into warmPresets
- add warmPresets to asset, which takes container presets plus only appropriate cp preset
- preset generator gets the presets from the new asset warmPresets method
- add test for preset generator
- remove preset generator presets array constructor arg since now it comes from the asset
- remove glide upload tests from asset test in favor of GeneratePresetImageManipulationsOnUpload. we know the event is dispatched.
also make the error output nicer and order containers by title
# Conflicts:
#	src/Imaging/GlideManager.php
#	tests/Feature/Fieldtypes/FilesTest.php
@jasonvarga jasonvarga merged commit c840e30 into master Jan 10, 2023
@jasonvarga jasonvarga deleted the feature/glide-asset-on-upload branch January 10, 2023 19:05
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.

5 participants