Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

magic_door

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magic_door

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= MagicDoor Generator

Generates custom button images with RMagick using the famous {sliding doors css tehnique}[http://www.alistapart.com/articles/slidingdoors].

== A brief introduction

While it can be argued that this functionality is being preceded by CSS 3, this code provides a happy crossbrowser experience, backed by the ability of using copyrighted fonts.

The script works by splitting a large wide image into two narrow ones that accomodate the length of a provided text. The location where the split ocurrs can be specified as an optional parameter.

If you're using rails be sure to check out the {custom helpers}[http://github.com/viseztrance/magic_door_helpers].

== Generating buttons

Bellow you'll find a simple example of creating an image button:

options = { :text => "Please click me" :image => "wide-button-template.png" :file_name => "click-me.png", :css => "color: #333; font-size: 25" }

file = MagicDoor.new(options) file.save

You may set defaults in order to make subsequent calls simpler:

MagicDoor.defaults.merge!({ :source_path => "/project/path/buttons", :destination_path => "/project/path/buttons/cache", :split_at => 11, :css => "padding: 10; font-weight: bold; font-size: 14; color: #fff; text-align: center; text-shadow: #cecefe 0 1; font: '/project/path/fonts/MyriadPro-Semibold.otf" })

== Limitations

All CSS sizes are calculated in pixels, so you should not add any measurement units after the numbers.

The padding property does not affect the top and bottom region.

Parsing the CSS and mapping it to RMagick is somewhat tendious, as such there are only a few css properties supported. Please consult the docs for a complete list.

== Command Line

You can run MagicDoor from the command line:

$ magic-door -t "hello world" -i "/home/daniel/Desktop/button.png" -f "/home/daniel/hello.png"

== Source code

The source code is hosted on Github: http://github.com/viseztrance/magic_door

To get MagicDoor from source:

git clone git@github.com:viseztrance/magic_door.git

== Acknowledgements

I would like to thank {OkapiStudio}[http://okapistudio.com] - my employer for allowing me to share this code.

== License

This package is licensed under the MIT license and/or the Creative Commons Attribution-ShareAlike.

FAQs

Package last updated on 20 Dec 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc