Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cannikin/twimage
A gem for pulling images from various Twitter image services
https://github.com/cannikin/twimage
Last synced: about 2 months ago
JSON representation
A gem for pulling images from various Twitter image services
- Host: GitHub
- URL: https://github.com/cannikin/twimage
- Owner: cannikin
- Created: 2011-05-11T03:49:18.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-02-08T19:42:51.000Z (almost 13 years ago)
- Last Synced: 2024-10-12T15:22:07.499Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 99.6 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Twimage
Twimage provides an easy way to pull raw images from the various Twitter photo image services (twitpic, yfrog, etc.)
## Usage
Add twimage to your Gemfile:
gem 'twimage'
Of without bundler:gem install twimage
Now simply take the standard URL that is posted to Twitter and tell Twimage to go get it:result = Twimage.get('http://instagr.am/p/EHqLG/')
Twimage will create a Ruby tempfile with the image. To get the tempfile:result.tempfile
Save the image to your local system, upload to S3, etc. As soon as there are no more references to the
tempfile in your code it will be unlinked (deleted). There are a couple additional instance variables
you have access to...try `result.inspect` to take a look.Twimage will follow any redirects that eventually get you to any of the included services. So, if you
have a Instagram image behind a Bitly shortened URL, just give the Bitly link to Twimage and he'll
(she'll?) take care of the rest.Enjoy!
## Support
Twimage currently supports the following photo services:
* twitpic - http://twitpic.com
* yfrog - http://yfrog.com
* instagram - http://instagr.am
* twitter - http://twitter.com## Contributing
To add a parser, fork this repo and then send me a pull request. You should attempt to get the highest resolution
version of the image possible, which isn't always available at the link posted to Twitter. Check out the `SERVICES`
constant in `twimage.rb` for examples of `lambda`s used to modify the original `service_url` to get to the full res
version's URL.