-
Notifications
You must be signed in to change notification settings - Fork 8
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
Feature : Allow resizing of files before downloading #22
Conversation
Updates the gem dependencies. Update bundler and rake.
Allow resizing of zipped files before downloading.
According to the documentation, `service_url` shouldn't be used directly. Replace the call to `service_url` with `url_for`.
Sending the `url_for` method isn't supported by all services.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR sounds greats, thank you very much. Could you just :
- take a look of small remarks
- increase version number (lib/active_storage/send_zip/version.rb) so I will be able to publish new version
- you may want to add your name in Gemspec :) .
# @param files [ActiveStorage::Attached::One|ActiveStorage::Attached::Many|Array|Hash] file(s) to save | ||
# @return [String] folder path of saved files | ||
def self.save_files_on_server(files) | ||
def self.save_files_on_server(files, resize_to_limit: nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add documentation about this params
# @param [Boolean] Allow resizing of files before downloading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@madeindjs hi! Yes, I will make the requested changes.
# read file from service | ||
# contents = URI.open(file.service.send(:url_for, file.key)) { |f| f.read } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove dead code ?
# read file from service | |
# contents = URI.open(file.service.send(:url_for, file.key)) { |f| f.read } |
Update the `CHANGELOG.yml` for version 0.3.4 with the resize feature.
Update the `README.md` with details on how to use the resize feature.
Increase the version number to 0.3.4. Add my name to the authors.
Document the `resize_to_limit` filter that can be applied to images before being zipped.
Add a test to ensure the behavior of resize_to_limit is working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great ! I will publish this new release on Rubygems soon. Thank you again.
@biximilien , new version pushed https://rubygems.org/gems/active_storage-send_zip/versions/0.3.4 🎉 |
I had needed to resize the zipped files to specific formats before downloading them.
This might be useful to someone else.