Understanding Image Uploads

Hi, I'm starting to look at uploading images to a web database.

I understand that the first thing I need to use is file_column so that the images are not stored in the database itself, but in the file system. Would I be right in saying that adding security to it (protecting it from prying eyes) would only be a matter of adding a before_filter to the system?

My other main problem is regarding integration of this web database with my Windows application. I want to do something like Picasa (I guess) where people can partially edit the picture on their PC and then click upload to send it to their web album. Does anyone have any references on how data is transferred over HTTP to send and receive image files? I'm reading this right now:
http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
but if someone has a better reference, I'd seriously appreciate it.

Thanks,
Mohit.

Hi, I'm starting to look at uploading images to a web database.

What's a web database ?

I understand that the first thing I need to use is file_column so that
the images are not stored in the database itself, but in the file
system. Would I be right in saying that adding security to it
(protecting it from prying eyes) would only be a matter of adding a
before_filter to the system?

No. You have to store images outside RAILS_ROOT/public and use
send_file from controller after validating access.

My other main problem is regarding integration of this web database with
my Windows application. I want to do something like Picasa (I guess)
where people can partially edit the picture on their PC and then click
upload to send it to their web album. Does anyone have any references
on how data is transferred over HTTP to send and receive image files?
I'm reading this right now:
http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
but if someone has a better reference, I'd seriously appreciate it.

You can probably try to use rmagick's to_blob function, then use Zlib
for compression and base 64 encode the data before transferring. But
I'm not sure if that'd improve the performance or not, logically it
should. You can use multipart post form for uploading and proper
content-type in http header for downloading the image.

just for your info: file_column seems to be abandoned, but theres an acts_as_attachement plugin, too

Hi Pratik,

Thanks for your response. My answers inline..

Pratik wrote:

  

Hi, I'm starting to look at uploading images to a web database.
    
What's a web database ?

Sorry, I should have termed it better - I did mean a web-enabled database. So, basically a MySQL database with a Rails app!

I understand that the first thing I need to use is file_column so tha
the images are not stored in the database itself, but in the file
system. Would I be right in saying that adding security to it
(protecting it from prying eyes) would only be a matter of adding a
before_filter to the system?

No. You have to store images outside RAILS_ROOT/public and use
send_file from controller after validating access.
  

Hmm, OK. Thanks for the pointer, will need to look into this!

My other main problem is regarding integration of this web database with
my Windows application. I want to do something like Picasa (I guess)
where people can partially edit the picture on their PC and then click
upload to send it to their web album. Does anyone have any references
on how data is transferred over HTTP to send and receive image files?
I'm reading this right now:
http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
but if someone has a better reference, I'd seriously appreciate it.
    
You can probably try to use rmagick's to_blob function, then use Zlib
for compression and base 64 encode the data before transferring. But
I'm not sure if that'd improve the performance or not, logically it
should. You can use multipart post form for uploading and proper
content-type in http header for downloading the image.
  

Hmm.. In my case, the client is a C++ program that runs under Windows, so I'm going to have do most of that myself, I guess.. But, if I understand you correctly, what's needed is compression -> base64 encode and use a multipart form and proper content-typing...

Hmm, a bit of a handful, but thanks for the pointers.. time to start looking at these things then!

Cheers
Mohit.

Thanks Michael.. that changes things - somehow, after all the talk of file_column that I have seen, I just expected it to be around :slight_smile:

Cheers
Mohit.

Michael Siebert wrote:

Nonsense.

File column is around and still kicking ass. :slight_smile: It may not
be under massivelly heavy development, but what more does it need?
It's had some new features added this year, and it certainly makes
image manipulation stuff (with rmagic) really easy. I'm using it for a
number of production sites, with great success.

regards,

Craig
www.craigambrose.com

I use file_column…it works

check out my site http://www.blogsaic.com/

upload some tiles

play around in your account, change the image for tiles you have already uploaded

you will see that file_column is pretty handy, simple

cheers

dion

Craig Ambrose wrote:

Nonsense.

File column is around and still kicking ass. :slight_smile: It may not
be under massivelly heavy development, but what more does it need?
It's had some new features added this year, and it certainly makes
image manipulation stuff (with rmagic) really easy. I'm using it for a
number of production sites, with great success.

regards,

Craig
www.craigambrose.com
  

I can sum up my emotion in one word: PHEW!
:slight_smile:
Cheers
Mohit.

Dion Hewson wrote:

I use file_column...it works

check out my site http://www.blogsaic.com/

upload some tiles

play around in your account, change the image for tiles you have already uploaded

you will see that file_column is pretty handy, simple

cheers

dion

Thanks Dion!
Cheers
Mohit.