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

Add image_file method to Placeholdit module #1217

Closed
nicolas-brousse opened this issue May 17, 2018 · 2 comments
Closed

Add image_file method to Placeholdit module #1217

nicolas-brousse opened this issue May 17, 2018 · 2 comments
Assignees

Comments

@nicolas-brousse
Copy link
Contributor

Hey,

Are you interested about a method to directly retrieve a file instead a url with Placeholdit module. The idea is to easily create attachment on an app without downloading the image file from URL.

Right now a created a method to do the job but may be it's something that could be done directly by Faker.

    def image_file(size = '300x300', format = 'png', background_color = nil, text_color = nil, text = nil)
      download_file image(size, format, background_color, text_color, text)
    end

    private

    def download_file(url)
      file = Tempfile.new("faker_placeholdit")
      file.binmode
      file << Net::HTTP.get(URI(url))
      file.close

      File.new(file.path)
    end

What do you thing about ? If you think It's interesting, let me know and I could work on a pull request.

@aamarill
Copy link

@vbrazo if you added the "feature request" tag, does that mean you'll accept a PR on this? 🤔

@vbrazo
Copy link
Member

vbrazo commented May 23, 2018

@aamarill no, I'm just categorizing the PRs and issues, so we can focus on the categories that we prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants