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

Feature : Allow resizing of files before downloading #22

Merged
merged 9 commits into from
Jul 26, 2020

Conversation

biximilien
Copy link
Contributor

I had needed to resize the zipped files to specific formats before downloading them.
This might be useful to someone else.

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.
Copy link
Owner

@madeindjs madeindjs left a 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 :

  1. take a look of small remarks
  2. increase version number (lib/active_storage/send_zip/version.rb) so I will be able to publish new version
  3. you may want to add your name in Gemspec :) .

Comment on lines 14 to 16
# @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)
Copy link
Owner

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

Copy link
Contributor Author

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.

Comment on lines 88 to 89
# read file from service
# contents = URI.open(file.service.send(:url_for, file.key)) { |f| f.read }
Copy link
Owner

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 ?

Suggested change
# read file from service
# contents = URI.open(file.service.send(:url_for, file.key)) { |f| f.read }

lib/active_storage/send_zip_helper.rb Show resolved Hide resolved
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.
@biximilien biximilien requested a review from madeindjs July 26, 2020 17:58
Copy link
Owner

@madeindjs madeindjs left a 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.

@madeindjs madeindjs merged commit 18b7443 into madeindjs:master Jul 26, 2020
@madeindjs
Copy link
Owner

@biximilien , new version pushed https://rubygems.org/gems/active_storage-send_zip/versions/0.3.4 🎉

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.

2 participants