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 #1243

Merged

Conversation

nicolas-brousse
Copy link
Contributor

This PR add a image_file method in Placeholdit module to get a File object of the image, instead of just the URL.

Close #1217.

@nicolas-brousse nicolas-brousse force-pushed the add-image-file-method-to-placeholdit branch from 4966656 to 882abc5 Compare May 23, 2018 09:57
@nicolas-brousse
Copy link
Contributor Author

I see the travis error RuntimeError: Faker::Placeholdit.image_file has an entropy leak, but I'm not sure to understand what to do to resolve this.

@stympy
Copy link
Contributor

stympy commented May 23, 2018

The leak probably comes from the use of tempfile, which uses randomness to get unique filenames. The solution would most likely be to not use tempfile.

However, I don't think this belongs in Faker. Having the image_file method in the doc would be great, though, to show people how to get that functionality.

@nicolas-brousse
Copy link
Contributor Author

@stympy Thanks for your answer. I'll try to have a look on it in the following days.

@nicolas-brousse
Copy link
Contributor Author

Else let me know if I have to remove my method, and just update the doc. I will update my method first, and then do changes in function of what we decide.

@stympy
Copy link
Contributor

stympy commented May 23, 2018

Yes, I'd recommend dropping the method and just include the method's code in the doc as an example of how to use the image method to get a file.

@vbrazo
Copy link
Member

vbrazo commented Jul 12, 2018

Any updates? @nicolas-brousse

@nicolas-brousse
Copy link
Contributor Author

Hey! Sorry I'm really busy those days. I'll try to have a look today to update this.

@nicolas-brousse nicolas-brousse force-pushed the add-image-file-method-to-placeholdit branch from 882abc5 to 7797c6f Compare July 29, 2018 14:37
Show how to use Placehold to download a file from Placeholdit url.
@nicolas-brousse nicolas-brousse force-pushed the add-image-file-method-to-placeholdit branch from 7797c6f to 400a6b6 Compare July 29, 2018 14:46
@nicolas-brousse
Copy link
Contributor Author

I made a change. Let me know if it's good enough or if you would like some changes.

@vbrazo
Copy link
Member

vbrazo commented Oct 19, 2018

@nicolas-brousse 👍

@vbrazo vbrazo merged commit ebaa7d9 into faker-ruby:master Oct 19, 2018
vbrazo pushed a commit that referenced this pull request Oct 19, 2018
* Add Faker::Vehicle.singapore_license_plate (#1410)

* Add Singapore vehicle license plate

* Update en-SG.yml

* Add image file method to placeholdit (#1243)

* Update Placeholdit doc

Show how to use Placehold to download a file from Placeholdit url.

* Code cleanup

* Add Faker::Games::SonicTheHedgehog

* Update README, CHANGELOG and documentation
davidmorton0 pushed a commit to davidmorton0/faker that referenced this pull request Jul 12, 2021
* Update Placeholdit doc

Show how to use Placehold to download a file from Placeholdit url.

* Code cleanup
davidmorton0 pushed a commit to davidmorton0/faker that referenced this pull request Jul 12, 2021
* Add Faker::Vehicle.singapore_license_plate (faker-ruby#1410)

* Add Singapore vehicle license plate

* Update en-SG.yml

* Add image file method to placeholdit (faker-ruby#1243)

* Update Placeholdit doc

Show how to use Placehold to download a file from Placeholdit url.

* Code cleanup

* Add Faker::Games::SonicTheHedgehog

* Update README, CHANGELOG and documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants