Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamesmoriarty/poto
multi cloud storage to image gallery + image proxy + file api - 350 LOC.
https://github.com/jamesmoriarty/poto
aws cloud-storage google-storage image-gallery ruby ruby-application s3
Last synced: about 1 month ago
JSON representation
multi cloud storage to image gallery + image proxy + file api - 350 LOC.
- Host: GitHub
- URL: https://github.com/jamesmoriarty/poto
- Owner: jamesmoriarty
- License: mit
- Created: 2015-06-08T09:17:56.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-07T04:09:30.000Z (almost 6 years ago)
- Last Synced: 2024-10-01T16:46:05.194Z (about 1 month ago)
- Topics: aws, cloud-storage, google-storage, image-gallery, ruby, ruby-application, s3
- Language: Ruby
- Homepage: https://jamesmoriarty-poto-aws-s3.herokuapp.com/
- Size: 2.23 MB
- Stars: 19
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Code Climate](https://codeclimate.com/github/jamesmoriarty/poto/badges/gpa.svg)](https://codeclimate.com/github/jamesmoriarty/poto) [![Test Coverage](https://codeclimate.com/github/jamesmoriarty/poto/badges/coverage.svg)](https://codeclimate.com/github/jamesmoriarty/poto/coverage) [![Build Status](https://travis-ci.org/jamesmoriarty/poto.svg?branch=master)](https://travis-ci.org/jamesmoriarty/poto)
# Poto
Turn your AWS S3 bucket into an image gallery.
![Demo GIF](/doc/Demo.gif "Demo GIF")
Example: http://jamesmoriarty-poto-aws-s3.herokuapp.com/
## Usage
### S3
$ PORT=? AWS_ACCESS_KEY_ID=? AWS_SECRET_ACCESS_KEY=? AWS_REGION=? AWS_S3_BUCKET=? poto-aws-s3
### Google Cloud Storage
$ PORT=? GOOGLE_CLOUD_PROJECT_ID=? GOOGLE_CLOUD_KEYFILE=? GOOGLE_CLOUD_STORAGE_BUCKET=? poto-google-cloud-storage
## Poto::ImageProxy
The image resizing proxy is rack middleware and can be used standalone.
```ruby
require "poto"# width - max width in pixels.
# height - max height in pixels.
# src - source image url.
#
# Examples
#
# GET /image_proxy?width=500&height=500&src=https%3A%2F%2Faqueous-cliffs-6127.herokuapp.com%3A443%2Fapi%2Ffiles%2FRGVhdGggVmFsbGV5LmpwZw%3D%3D%250Amap("/image_proxy") do
run Poto::ImageProxy
end
```## Poto::API
As well as the API - query and access the storage backend via hal+json.
```ruby
require "poto"
require "poto/file_repository/aws/s3"# Examples
#
# GET /files&per_page=9
# {
# "_embedded": {
# "files": [{
# "name": "Abstract.jpg",
# "size": 15198281,
# "_links": {
# "file": {
# "href": "https://aqueous-cliffs-6127.herokuapp.com:443/api/files/QWJzdHJhY3QuanBn%0A"
# }
# }
# }]
# },
# "_links": {
# "self": {
# "href": "https://aqueous-cliffs-6127.herokuapp.com:443/api/files?page="
# },
# "next": {
# "href": "https://aqueous-cliffs-6127.herokuapp.com:443/api/files?page=Death+Valley.jpg&per_page=9"
# }
# }
# }repository = Poto::FileRepository::AWS::S3.new(bucket: ENV["AWS_S3_BUCKET"])
map("/api") do
run Poto::API.configure(repository: repository)
end
```## Installation
$ gem install poto
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
1. Fork it ( https://github.com/[my-github-username]/poto/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request