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

Update image settings documentation #4245

Merged
merged 4 commits into from
Jun 8, 2022

Conversation

nbelzer
Copy link
Contributor

@nbelzer nbelzer commented Jan 17, 2022

Resolves #3700

Description

As outlined in my comment on #3700 the guides recommend the use of a code snippet to override the attachment styles used in Spree::Image. However, b1fa1b8 introduced configuration options, that can be set from Spree::Config in an initializer like config/initializers/spree.rb.

This PR introduces updated documentation for the developer guides to reflect both the introduction of this configuration and the newly introduced Active Storage backend for Spree::Image in Solidus 3.0.

Spec Tests

To verify that this behavior is correct I have included a set of tests for both of the available backends for Spree::Image.


The developer guides also mention Paperclip as the reason for the system requirement of ImageMagick. Perhaps this is also outdated as, since we are using Active Storage by default, it is also possible to use libvips (as outlined in the Active Storage Requirements as a faster and less memory intensive replacement for ImageMagick). I believe we should therefore also update these requirements.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

@nbelzer nbelzer changed the title Update image settings Update image settings documentation Jan 17, 2022
@nbelzer
Copy link
Contributor Author

nbelzer commented Jan 17, 2022

The same update to the guides should be made for the EdgeGuides, I found this PR which already includes these changes.

@nbelzer nbelzer force-pushed the image-settings#3700 branch from 86462ce to aea45af Compare January 18, 2022 13:26
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The developer guides also mention Paperclip as the reason for the system requirement of ImageMagick. Perhaps this is also outdated as, since we are using Active Storage by default, it is also possible to use libvips (as outlined in the Active Storage Requirements as a faster and less memory intensive replacement for ImageMagick). I believe we should therefore also update these requirements.

@nbelzer thanks. 👆 please mention this as well.

@nbelzer
Copy link
Contributor Author

nbelzer commented Feb 3, 2022

@kennyadsl d739f87 includes an update to the requirements section that includes the changed requirements. I made sure to mention that the changes are related to the chosen image backend and that stores that are using paperclip are still referred to using ImageMagick.

@nbelzer
Copy link
Contributor Author

nbelzer commented Feb 3, 2022

We might also want to change the following lines to instead include libvips instead of imagemagick in the example brew install command:

Using Homebrew, you can install all of the requirements using the following
commands:
```bash
brew install ruby sqlite3 imagemagick
gem install rails
```

The consideration on changing this line would be that it less likely that the user has libvips installed (compared to imagemagick). Therefore, we would potentially increase the amount of time it takes to get started with Solidus for new users.

@nbelzer nbelzer force-pushed the image-settings#3700 branch from 5d07cd2 to 17ea16d Compare February 8, 2022 14:44
@nbelzer
Copy link
Contributor Author

nbelzer commented Feb 8, 2022

I have cleaned up the git history.

Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nbelzer thank you! 🙌

Copy link
Contributor

@waiting-for-dev waiting-for-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, @nbelzer!

Sorry for taking a look into it so late. I just left a minor suggestion I think it'd be great to integrate. Let me know if you have any concern 🙂

nbelzer added 4 commits June 8, 2022 13:58
Introduce tests to verify the configuration options added in
b1fa1b8.

After trying many different options to have `Spree::Image` re-evaluate
the newly set preferences dynamically, I found this working solution. As
`Spree::Image` is used in other spec tests it might already be loaded,
and therefore has already evaluated the previous preferences.

In this solution I decided to make use of a test-specific class that is
equivalent to `Spree::Image`, but uses a fixed include (instead of a
dynamic one).  Each test contains one of the test-specific classes with
a fixed include that references one of the potential
`image_attachment_module`s.

By including the custom class in the test we get the ability to directly
influence the `Spree::Config` values that will be used upon definition
of the class.  Using the `stub_spree_preferences` we can set these
preferences, without influencing other tests in test suite.

The downside of this approach is that we should reflect changes to the
`Spree::Image` class in the custom classes within (if the changes affect
related behavior).
Because Paperclip is no longer the default for stores starting with
Solidus 3, this documentation change reflects the change in requirements
related to that (at least related to the image processing).  Libvips is
an alternative for ImageMagick that can be used by ActiveStorage.
@nbelzer nbelzer force-pushed the image-settings#3700 branch from 17ea16d to 679af53 Compare June 8, 2022 11:59
@nbelzer
Copy link
Contributor Author

nbelzer commented Jun 8, 2022

Thanks for the suggestion @waiting-for-dev, I think that is a way better approach, learned something new today!

@nbelzer nbelzer requested a review from waiting-for-dev June 8, 2022 11:59
@waiting-for-dev waiting-for-dev merged commit 7d7b64d into solidusio:master Jun 8, 2022
@waiting-for-dev
Copy link
Contributor

Thanks for your work, @nbelzer!

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.

Not able to change images size
4 participants