Chapter 11. Image Is Everything

In This Chapter

  • Storing photos (and other binary data) in a database

  • Uploading images (and other data) to a Web site

  • Working with a request and its response

Everyone has phobias. My uncle is afraid of heights. My best friend from high school is afraid of aging. (Too bad! Heights are easier to avoid than aging.) A student of mine is afraid of fish. A colleague in my department is afraid of mirrors (as well he should be). My cat is afraid of wolves. And me? I'm afraid of things that loosely dangle, such as hanging threads, orphan sentences, and other such things.

There must be a name for this kind of phobia. Maybe it's loosia‐danglo‐phobia. (Don't confuse this ailment with Lucy‐phobia, which pertains only to old television sitcoms.) I don't know what bothers me about loosely dangling things. You can't account for taste or for phobias. Maybe I was frightened by a loosely dangling thing when I was a young child. (Or maybe I'm just crazy!)

Anyway, this book has a stunning example of a loosely dangling thing. It's a file stored in a Rails project's public\images directory.

The skeptics among you might ask “What's dangling about the public\images directory?” The answer is in Chapter 10. In that chapter, you create a database that supposedly stores all information about photos. But this big, hulking database doesn't store images. Instead, the database stores filenames. These filenames are frail tentacles that extend outside the database and into the rest of the ...

Get Ruby on Rails For Dummies® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.