# Take a picture from the webcam and save it into the database

**URL:** <https://www.ruby-forum.com/t/take-a-picture-from-the-webcam-and-save-it-into-the-database/157999>\
**Category:** Rails\
**Created:** [January 17, 2009, 5:12pm UTC](https://www.ruby-forum.com/t/take-a-picture-from-the-webcam-and-save-it-into-the-database/157999 "2009-01-17T17:12:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![consider](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7feea3/32.png) [@consider](https://www.ruby-forum.com/u/consider)\
**Post date:** [January 17, 2009, 5:12pm UTC](https://www.ruby-forum.com/t/take-a-picture-from-the-webcam-and-save-it-into-the-database/157999/1 "2009-01-17T17:12:06Z")

</div>

Hi everyone,

I’m trying to create an application to take pictures from the users’  
webcam and save them into the database.

This is my actionscript code :

Code :

1. import flash.display.BitmapData;
2. localCamera = Camera.get();
3. myCam.attachVideo(localCamera);
4. 
5. var bitmap = new flash.display.BitmapData(320, 240, true,  
0x00000000);
6. this.createEmptyMovieClip(“pic”, 2);
7. pic.attachBitmap(bitmap, 20, “auto”, true);
8. btn.onRelease = function() {
9. lv = new LoadVars();
10. lv.tab = new Array();
11. for (i=0; i\<240; i++) {
12. 

```
for (j=0; j<320; j++) {

```

13. 

```
  lv.tab.push(bitmap.getPixel(j, i));

```

14. 

```
}

```

15. }
16. lv.send(“validate\_upload\_flash”, “\_blank”, “POST”);
17. };

And here comes my issue : in PHP, I’d use a imagesetpixel method. But in  
RoR, I just don’t know what to do !

Any help ?
