Hi, I’m using file_column to save images to the file system. To protect
the images, I’m uploading to a non-publicly accessible directory.
Therefore, I’m using a controller method to send the file when
requested:
def get_pic
@fctrial = Fctrial.find(params[:id])
send_file(@fctrial.image, {:disposition => ‘inline’, :type =>
‘image/jpeg’})
end
As you can see, I’m setting the :type to ‘image/jpeg’ so obviously this
is not correct for image/png or image/gif. How do I get to send the
correct content type? Should I save the content type in the database
also? Is there some simpler way?
Thanks,
Mohit.