0.0
No commit activity in last 3 years
No release in over 3 years
Generate ImageBoss URLs with Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0
 Project Readme

ImageBoss logo

ImageBoss Helper for Ruby

Build Status Gem Version

Official Gem for Generating ImageBoss URLs. https://imageboss.me/

Table of Contents

  • ImageBoss Helper for Ruby
    • Installation
    • Usage
      • Example Image Resizing With Cover Operation
      • Example Image Resizing With Height Operation
      • Example Image Resizing With Extra Options
      • All operations and options for Image Resizing
      • Disabling URL generation
      • Signing your URLs
    • Tested on

Installation

Add this line to your application's Gemfile:

bundle add imageboss-rb

Or install it yourself as:

gem install imageboss-rb

Usage

Example Image Resizing With Cover Operation

client = ImageBoss::Client.new(source: 'mywebsite')

image_url = client.path('/images/img01.jpg')
                  .operation(:cover, width: 100, height: 100)

#=> https://img.imageboss.me/mywebsite/cover/100x100/images/img01.jpg

Example Image Resizing With Height Operation

client = ImageBoss::Client.new(source: 'mywebsite')

image_url = client.path('/images/img01.jpg')
                  .operation(:height, height: 100)

#=> https://img.imageboss.me/mywebsite/height/100/images/img01.jpg

Example Image Resizing With Extra Options

client = ImageBoss::Client.new(source: 'mywebsite')

image_url = client.path('/images/img01.jpg')
                  .operation(:width, width: 100, options: { grayscale: true })

#=> https://img.imageboss.me/width/100/grayscale:true/images/img01.jpg

All operations and options for Image Resizing

It's all available on our Official Docs.

Disabling URL generation

If you are coding on test, development environments and don't want to send any image to ImageBoss you can always disable the URL generation and the client will just fallback to the original path provided.

client = ImageBoss::Client.new(source: 'mywebsite', disabled: true)

image_url = client.path('/images/img01.jpg')
                  .operation(:width, width: 100, options: { grayscale: true })

#=> /images/img01.jpg

This will give you the ability to see your image without adding extra code to handle this situation.

Signing your URLs

Read more about this feature here: https://www.imageboss.me/docs/security

client = ImageBoss::Client.new(source: 'mywebsite', secret: '<MY_SECRET>')

image_url = client.path('/images/img01.jpg')
                  .operation(:width, width: 100)

#=> https://img.imageboss.me/width/100/images/img01.jpg?bossToken=ff74a46c7228ee4262c39b8d501c488293c5be9d433bb9ca957f32c9c3d844ab

This will give you the ability to see your image without adding extra code to handle this situation.

Tested on

Ruby

  • 2.6.3
  • 2.5.1
  • 2.4.4
  • 2.3.7
  • 2.2.7
  • 2.1.10

jRuby

  • jruby-9.0.5.0

Rubinius

  • rbx-3.100