11.6. Summary

Graphics have been an important part of the Web since the beginning. There are a number of different tools for supporting graphic manipulation in Rails. The most important library is RMagick, but MiniMagick and ImageScience are also useful. Installing any of the three projects can be complex.

The attachment_fu plugin offers great support for accepting uploaded files such as images from users, validating them, and storing the metadata in the database. attachment_fu supports storing the file in the file system, the database, or Amazon's S3 online storage.

ImageScience is used only for resizing images. RMagick allows for a wide variety of different image-manipulation functions, including piecing together animated GIFs, various kinds of color filtering, and low-level primitive drawing. MiniMagick offers most of the same functionality as RMagick, but it relies on command-line calls to the underlying graphics library, rather than on an ongoing process.

Gruff is a simple library for creating charts. You can easily set chart types and data in your code, and there's a flexible API to tune the output display. Sparklines are small, inline graphs that can be created using a sparkline plugin.

Get Professional Ruby on Rails™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.