0.0
No commit activity in last 3 years
No release in over 3 years
A simple placeholder image generator
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.9.7
>= 2.13.2
 Project Readme

PixelHolder-RubyGem

The PixelHolder RubyGem - A RubyGem for creating image placeholders.

Check out PixelHolder Sinatra for a sample implementation.

Installation

gem install pixelholder

Usage

Flickr Images:

image = PixelHolder::Flickr.new(options = {})

Gradient:

image = PixelHolder::Gradient.new(options = {})

Solid Fill:

image = PixelHolder::Fill.new(options = {})

The PixelHolder classes have an accessible canvas variable (our generated image). To get the image as a blob:

blob = image.canvas.to_blob

PixelHolder can also be extended by extending the base class PixelHolder::Base. This allows you to create customised placeholder classes quickly without setting up the foundations needed.

Options

options = {
  width: 600,
  height: 300,
  text: "whatever you want to go here can go here!", # Your overlay text. Set to "show_dimensions" to show image dimensions
  text_color: "#ffffff", # Color for overlay text
  image_format: "jpg", # Image format - jpg, png etc.

  # Fill only
  background_color: "#0099cc", # Six character hex color code

  # Gradient only
  direction: "horizontal", # Horizontal or vertical gradient. Default vertical.
  start_color: "#ffffff", # Six character hex color code
  end_color: "#0099cc", # Six character hex color code

  # Flickr Only
  flickr_tags: "cat,dog", # Comma separated tags.
  flickr_key: "<your flickr key>",
  flickr_secret: "<your flickr secret>",
  seed: 4 # Integer to select a different image result from Flickr
}