public
Description: A lightweight and opinionated but hackable library for attaching images to ActiveRecord models.
Homepage:
Clone URL: git://github.com/norman/has_image.git
Norman Clarke (author)
Wed Oct 22 07:01:38 -0700 2008
commit  7245d7024a48e08e641e8b6c2253d561e6cbd25f
tree    709d07bd0c23b2c24a054809311a8e6d7bb15933
parent  756d467405fc9cc7c275bd479f8d79eff1480b11
has_image / FAQ
100644 25 lines (18 sloc) 1.043 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
= Frequently Asked Questions
 
HasImage is too new to have many FAQ items yet. {Ask
me}[mailto:norman@randomba.org] and they will be included; this is a work in
progress.
 
= How do I validate the mime type of my uploaded images?
 
You don't. Rather than examine the mime type, HasImage runs the "identify"
command on the file to determine if it is processable by ImageMagick, and if
it is, converts it to the format you specify, which defaults to JPEG.
 
This is better than checking for mime types, because your users may upload
exotic image types that you didn't even realize would work, such as Truevision
Targa images, or Seattle Film Works files.
 
If you wish to give users a list of file types they can upload, a good start
would be jpeg, png, bmp, and maybe gif and ttf if your installation of
ImageMagick understands them. You can find out what image types your
ImageMagick understands by running:
 
identify -list format
 
Ideally, if your users just upload files that "look like" images on their
computers, it HasImage should "just work."