Serving image files from filesystem

I’m pretty new to Ruby and Rails. I am writing a Rails application

that is meant to be run on a local machine. It allows the user to

select a bunch of image (jpg, gif, etc) files from anywhere on their

file system and add them to an album.

The prototype of the is app is going to leave the images where they are

on the disk (and not persist them anywhere else). I want to write a

controller that can take an image name and location on disk as a

parameter and then serve the file to the user via the WEBrick server so

that the image appears properly in the browser.

Is there any sample code anywhere for opening a binary file and serving

it as jpg (or whatever) to the user?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs