Saving webcam images into database

Hi,
I have managed to acquire the image from my webcam through the vision acquisition software but now i faced a problem because i want the image to be stored in the database so that it could be view from a webpage( like a video stream).
What i did in my vi was just take the image out and connected it directly to the database and data is going in the database but when i tried to display it on the webpage it does not show.
Is it possible to do that and if so is there any tutorials i can refer to?
Solved!
Go to Solution.

You should not save an image to database, since it'll make database slow, and difficult to write a web page to load image.
Save an image to specific location, and save image location to database.
Then, use <img> tag to call an image in web page.

Similar Messages

  • Save images into database

    hello, i have been fighting with this for some days, i have a picture that i load with de filerence.load method. and then,
    i use the filereference.data to show the picture into the image control.
    i need to save the image into database, but i can't. i don't know how i can convert the bytearray into hexa string or binary!!!

    Hi Sai,
           I am getting the error ArgumentError: Error #2015: Invalid
    BitmapData. When I am trying to change the image into byteArray using
    BitMapData.
          Below is the code i am using for this scenario. I am trying to get
    byteArray of the image after the image is completely loaded in the
    onComplete().
    private function initFunction(event:Event):void{
    uploadFile =new FileReference();
    imgTypes=new FileFilter("images(.JPG,.JPEG,.PNG,.GIF)",*
    ".JPG;.JPEG,.PNG;.GIF;"*);
    private function browseFile():*void
    uploadFile.addEventListener(Event.SELECT, onFileSelected);
    *try
    uploadFile.browse();
    catch(err:Error)
    logData(err.message);
    private function onFileSelected(event:Event):*void
    uploadFile.addEventListener(ProgressEvent.PROGRESS, onProgress);
    uploadFile.addEventListener(Event.COMPLETE, onComplete);
    uploadFile.load();
    private function onProgress(event:ProgressEvent):*void
    logData("Loaded " + event.bytesLoaded + " of " + event.bytesTotal + *"
    bytes."*);
    private function onComplete(evt:Event):*void
    logData("File was successfully loaded.");
    *//image.source = uploadFile.data;
    image.source=uploadFile.name;
    Alert.show("image source:"+image.source);
    var bitmapData:BitmapData = new BitmapData(image.width,image.height);
    var ba:ByteArray = png.encode(bitmapData);
    Alert.show("bytes loaded"+ba);
    Thanks,
    Ravi.
    On Sat, Nov 20, 2010 at 9:19 PM, ravindharreddy Baddam <

  • How to store an image into database table

    Hi
    Can anyone tell me the way, how to store an image into database table.

    Hello,
    May be this thread will help you in your requirement.
    [FM for uploading Image to SAP;
    Thanks,
    Jayant

  • Problem in saving the image into SQL database..

    Hello,
    In my application I have to save image file (say jpg) into the database and retrieve back and display it on the applet. I am through with grabbing the pixels of the image & sending the pixel array to the servlet but I am struck in how to store the image into the database and retrieve the same.
    Can anybody please help me in this regard... its really urgent...
    Thanks in advance
    Swarna

    Hello.
    I've been researching this problem (saving images in a MySQL database) in order to accomplish a task I was assigned to. Finally I was able to do it. I'd be glad if it will be of any use.
    First of all: the original question was related to an applet. So, the post from rkippen should be read. It says almost everything, leaving the code job for us. Since I managed to write some code, I'll put it here, but I'm not dealing with the byte transferring issue.
    To obtain a byte array from a file I'd open the file with FileInputStream and use a loop to read bytes from it and save them into a ByteArrayOutputStream object. The ByteArrayOutputStream class has a method named �toByteArray()� which returns an array of bytes (byte [] b = baos.toByteArray()) that can be transferred in a socket connection, as said by rkippen.
    My problem was to save an image captured by a web camera. I had an Image object, which I converted into a byte array and saved into the database. Eventually I had to read the image and show it to the user.
    The table in the MySQL database could be:
    CREATE TABLE  test (
      id int(11) NOT NULL auto_increment,
      img blob NOT NULL,
      PRIMARY KEY  (id)
    )I had problems trying to use the �setBlob� and �getBlob� methods in the Statement object, so I used the �setBytes� and �getBytes� methods . In the end, I liked these methods most because they where more suitable to my application.
    The database operations are:
        public int insertImage(Image image) throws SQLException {
            int id = -1;
            String sql = "insert into test (img) values (?)\n";
            PreparedStatement ps = this.getStatement(sql);  // this method is trivial
            byte [] bytes = this.getBytes(imagem); // * see below
            ps.setBytes(1, bytes);
            ps.executeUpdate();
            id = ps.getGeneratedKeys().getInt(0); //Actually I couldn't make this line work yet.
            return id;
        public Image selectImage(int id) throws SQLException {
            Image img = null;
            String sql = "select img from test where id = ?\n";
            PreparedStatement ps = getStatement(sql);
            ps.setInt(1, id);
            ResultSet rs = ps.executeQuery();
            if (rs.next()) {
                byte [] bytes = rs.getBytes(1);
                img = this.getImage(bytes); // * see below
            return img;
        }* If the bytes are read directly from a file, I think it is not necessary to convert it into an Image. Just send the bytes to the database method would work. On the other hand, if the image read form the DB will be written directly into files, the bytes obtained from rs.getBytes(1) would be enough.
    The image operations are:
        public byte [] getBytes(Image image) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            try {
                ImageIO.write(this.getBufferedImage(image), "JPEG", baos);
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            return baos.toByteArray();
        public Image getImage(byte [] bytes)  {
            Image image = null;
            ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
            try {
                image = ImageIO.read(bais);
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            return image;
        public BufferedImage getBufferedImage(Image image) {
            int width = image.getWidth(null);
            int height = image.getHeight(null);
            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            Graphics2D g2d = bi.createGraphics();
            g2d.drawImage(image, 0, 0, null);
            return bi;
        }That's it. I hope it is useful.

  • Saving images into database

    Hi All,
    I have a table with 3 BLOB columns to store images and a NUMBER type column to store the image id_no. I am using database 10g and Forms 6i
    My problem is I recently updated the database from 8i to 10g, and since then I am unable to update or insert the new images in these BLOB columns. When I update the existing image or insert new image record through forms, It does save the changes in existing or new record. But It does not show these images while query the record. and also does not give any error while executing the query in forms.
    But while trying to retrive the image from updated records or new record in reports, It throughs the error that image is format is unreadable or currupt.
    There wasn't any problem in 8i, i could update the record as many times I wanted or create as many records as needed.
    Is anybody have any clue about this problem! Any help in this regard will be highly appriciated.
    Thanking you and Best Regards.

    You should not save an image to database, since it'll make database slow, and difficult to write a web page to load image.
    Save an image to specific location, and save image location to database.
    Then, use <img> tag to call an image in web page.

  • Urgent : how to put an image into database and how to get it from it?

    hi,
    in the database i made a longblob type for image, and in my java code i have the path of the image (String): "C:\............." and i want to put this image in my data base.
    also i want to know how to get the image after put it in the database.
    please help me, it's so urgent.

    This is a way of getting the image out of the database.
    class yourClass{
    private byte[] buff;
    private ByteArrayOutputStream byteArrayOutputStream;
    public yourClass()
    Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    ResultSet result = statement.executeQuery("your query");
    while ( result.next()){
    try{
    BufferedInputStream bin = new BufferedInputStream(rs.getBinaryStream("imagecolumn"));
    byteArrayOutputStream = new ByteArrayOutputStream();
    int length = bin.available();
    buff = new byte[length];
    while ( bin.read( buff, 0, length ) != -1 ) {
    byteArrayOutputStream.write( buff, 0, length );
    bin.close();
    catch(Exception e){
    The class about is used to take the image out of the database and store it in an object which is then streamed out through a servlet to display on the jsp page.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    public class ImageServlet extends HttpServlet {
    public void init() throws ServletException {    }
    public void destroy() {    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    try
    yourClass pro = (yourClass)request.getSession().getAttribute("object");
    while ( iterator.hasNext() ) {
    pro = ( Product ) iterator.next();
    response.setContentType("image/jpg");
    ByteArrayOutputStream byteArrayOutputStream = pro.getImage();
    response.setContentLength( byteArrayOutputStream.size() );
    response.getOutputStream().write( byteArrayOutputStream.toByteArray() );
    response.getOutputStream().flush();
    return;
    catch (Exception e)
    e.printStackTrace();
    throw new ServletException(e);
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    This is a little messy but if you search the forums you will find out more on it. Search for Images and database.

  • How to upload images into database.

    I have a employee table. I want to upload the image of the corresponding employee. How can we achieve this ??
    Edited by: Manjunath CN on Oct 14, 2008 2:15 PM

    Hi Manjunath,
    Please check Sikindar  post in  this link
    Photo Upload
    Tcode OAAD.
    Click on the Create button. Business object PREL and Docyment type HRICOLFOTO. Click on create (fill in the right personnel number in the pop up and click Continue).
    Choose the photo (as a JPG file) from the place where it is saved (e.g. hard disk). SAP will notify that the Stored Document was created succesfully.
    Photo is visible via PA10, PA20, PA30, PA40. Double-click to magnify photo.
    Best regards,
    raam

  • Uploading images into database using webforms...

    Hi,
    I'm trying to upload images in to the database. This is possible on a normal form running the forms runtime, but how do i do it when is comes to webforms?
    Thanx in advance!

    hai roshapt
    what is the fine extension u r using.to get the images to disply in web also place the image file in the same path where u place the
    .fmx forms or create a virtual directory for images and configure that virtual directory also.
    regards
    ramesh.

  • Saving a number into database

    I already calculated using the 'calculation' at the properties pallete. I put the calculated value into a box i created. The box is for display only. If i ownself put the number inside.. when i click 'save' then my database will save the number. But since the box i created just now is 'view only' then it wont store in database. I already set the 'database item' to 'yes'
    i dont get it why it still wont save into the database.
    Please help.

    Your question is Oracle forms question, you can ask it in the forms forum.
    nevertheless, check the item name if it is the same name as the column name in your table. make sure that the item you created is a database item.
    and check for errors.
    Tony Garabedian
    To Nicolas: Congratulations for the Ace :) I've been away for while, it's nice surprise to see you got it. keep on the good work. Cheers.
    Tony G.

  • Saving webcam images to a server

    I would like to write a flash app that accesses a local
    webcam and then on
    the click of a button saves a jpg image to a server.
    Is this possible, and are there any examples or tutorials.
    Many thanks
    Dave

    I'm reading more about this and it seems that this method of
    using flash is
    going to be quite intensive for the client machine to send
    the data to the
    server and for the server to process and save the jpeg.
    I had hoped it would be a quick task which would not be too
    intensive.
    Ideally I want to have 10 client machines connected to 1
    server. Each client
    machine has a webcam, and can save images of people to the
    server.
    Is this looking unlikely?
    Also, is there any similar script for asp/vbscript?
    Thanks
    "dave" <[email protected]> wrote in message
    news:e4v14o$4e6$[email protected]..
    > Thanks blemmo
    >
    > It looks quite tricky but I'll have a play with it.
    >
    > "blemmo" <[email protected]> wrote in
    message
    > news:e4uupl$1e9$[email protected]..
    >> hi Dave,
    >>
    >> it's possible with Flash 8, see this tutorial: <a
    target=_blank
    >> class=ftalternatingbarlinklarge
    >> href="
    http://www.sephiroth.it/tutorials/flashPHP/print_screen/">http://www.sephi
    >> roth.it/tutorials/flashPHP/print_screen/</a>.
    Combine it with this
    >> tutorial: <a
    >> target=_blank class=ftalternatingbarlinklarge
    >> href="
    http://www.adobe.com/devnet/flash/articles/webcam_motion_03.html">http://w
    >>
    ww.adobe.com/devnet/flash/articles/webcam_motion_03.html</a>,
    and you
    >> should be
    >> there.
    >>
    >> hth,
    >> blemmo
    >>
    >
    >

  • Saving form information into database or file or cookie

    While a user is surfing through a particular site(jsp pages) on intranet, I need to save the selections he makes on the formof those pages. I would have used cookie but the user might try to use a different browser or computer to access the same page. So the choices are saving in a file or saving in database. Which one should I use?

    How would you select your records from the file - if it is going to be simple and you really won't ever be doing anything complicated then a file may be OK. If you start to delete/update records then you would find it simpler in a database. At the end of the day its your call ! Write your code so that you make the data storage classes sufficiently abstract so that its simpler later to change your mind.

  • How to insert files or images into database using mysql

    i need one example how to store files and retrive from database
    give me examples on storing and retriving foles or images

    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/htdocs/templates.htm#LOBS

  • Inserting Multiple Images into oracle database using JDBC

    I wanted to insert multiple images into database using JDBC by reading it from the file... and i am passing photos.txt(my text file) as an input parameter... I have inserted all the values into the database except for the image part... this is my content of photos.txt file and i have copied all the images into the folder
    *" C:\\photos "*
    *1,in1.jpg,108,19,in-n-out*
    *2,in2.jpg,187,21,in-n-out*
    *3,in3.jpg,308,41,in-n-out*
    *4,in4.jpg,477,52,in-n-out*
    *5,in5.jpg,530,50,in-n-out*
    and i want to store in1.jpg,in2.jpg,in3.jpg,in4.jpg,in5.jpg into the oracle databse using JDBC.... i have tried a lot using BLOB column.... and i have created my table as
    CREATE TABLE PHOTO(
    ID NUMBER NOT NULL PRIMARY KEY ,
    Name BLOB,
    X DOUBLE PRECISION,
    Y DOUBLE PRECISION,
    Tags VARCHAR2(40)
      try {                 // for restaurant System.out.println();System.out.println();System.out.println(); System.out.print("  Creating Statement for Photo...\n");             stmt2 = con.createStatement ();                       stmt2.executeUpdate("delete from PHOTO"); stmt2.executeUpdate("commit"); PreparedStatement stmt3 = con.prepareStatement ("INSERT INTO PHOTO VALUES (?, ?, ?, ?, ?)");             System.out.print("  Create FileReader Object for file: " + inputFileName1 + "...\n");             FileReader inputFileReader2 = new FileReader(inputFileName1);             System.out.print("  Create BufferedReader Object for FileReader Object...\n");             BufferedReader inputStream2  = new BufferedReader(inputFileReader2);             String inLine2 = null;                         String[] tokens; //            String[] imageFilenames = {"c:\\photos\\in1.jpg","c:\\photos\\in2.jpg","c:\\photos\\in3.jpg","c:\\photos\\in4.jpg","c:\\photos\\in5.jpg", //  "c:\\photos\\in6.jpg","c:\\photos\\in7.jpg","c:\\photos\\in8.jpg","c:\\photos\\in9.jpg","c:\\photos\\in10.jpg","c:\\photos\\arb1.jpg","c:\\photos\\arb2.jpg", //  "c:\\photos\\arb3.jpg","c:\\photos\\arb4.jpg","c:\\photos\\arb5.jpg","c:\\photos\\den1.jpg","c:\\photos\\den2.jpg","c:\\photos\\den3.jpg", //  "c:\\photos\\den4.jpg","c:\\photos\\den5.jpg","c:\\photos\\hop1.jpg","c:\\photos\\hop2.jpg","c:\\photos\\hop3.jpg","c:\\photos\\hop4.jpg","c:\\photos\\hop5.jpg"};               File file = new File("C:\\photos\\in1.jpg");            \\ ( Just for example  )           FileInputStream fs = new FileInputStream(file);                         while ((inLine2 = inputStream2.readLine()) != null) {               tokens= inLine2.split(",");             st2 = new StringTokenizer(inLine2, DELIM);                                                             stmt3.setString(1, tokens[0]);               stmt3.setBinaryStream(2, fs, (int)(file.length()));               stmt3.setString(3, tokens[2]);               stmt3.setString(4, tokens[3]);               stmt3.setString(5, tokens[4]);               stmt3.execute(); //execute the prepared statement               stmt3.clearParameters(); 
    As i am able to enter one image file by above code in1.jpg in to the oracle database.... but i am not able to insert all the image file in to the database.....do tell me what should i do.... and can you give me the example on the basis of the above code of mine...
    do reply as soon as possible..

    jwenting wrote:
    that depends. Putting the images in BLOBs prevents the file locations stored in the database from getting out of synch with the filesystem when sysadmins decide to reorganise directory structures or "archive" "old" files that noone uses anyway.True, but it really comes down to a business decision (cost-benefit analysis). If you have the bucks, the expertise, and the time, go with the Blobs, otherwise go with the flat files.

  • RE: Images from Database into W

    I've found that a good way to store images was not in the database, but
    in files on the server in GIF format and then store the filenames in the
    database. That way you avoid the BinaryData mess, the cursor
    requirement for blobs, and can store in a compressed form..
    You just have the service read in the image from the data file and pass
    it back to the requestor, if I remember right.. Also nice because the
    same GIF files can be used in normal HTML web pages..
    -Greg
    Greg Nyberg, Senior Consultant
    BORN Information Services Group
    (612) 404-4217 Fax: (612) 404-4440
    <[email protected]>
    From: Brendan Duddridge[SMTP:[email protected]]
    Sent: Monday, April 28, 1997 12:28 PM
    To: Forte ListServe
    Subject: Images from Database into W
    TransCanada PipeLines P.O. Box
    1000, Station
    M
    Calgary,
    Alberta, T2P
    4K5
    Telephone:
    (403)
    267-6100
    FAX: (403)
    267-6444/5/6
    Corporate Head Office
    Reply: Images from Database into Web SDK 1.1 page
    Hi,
    I want to be able to read images in from a database and have Forte
    generate a web page with those images.
    Does anyone know what the MIME type would be for a Forte ImageData
    object? Do I have to store the images into the database in gif format
    or is there some other MIME format that Forte uses to store ImageData
    objects. Also, can Netscape or Internet Explorer read those images?
    Here is the ReturnImage page builder method I created:
    =============================================================
    Response : HTTPResponse = new();
    LUIObject_ID : Integer;
    LUIObject_TD : TextData = new();
    aLUIObject : LUIObject;
    aBinaryData : BinaryData = new();
    aStream : MemoryStream = new();
    // Retrieve LUIObject_ID from http parameters
    LUIObject_TD = pRequest.FindNameValue('LUIObject_ID');
    LUIObject_ID = LUIObject_TD.IntegerValue;
    // Retrieve aLUIObject for the specified LUIObject_ID from the
    database.
    // This object contains various ImageData attributes which contain the
    // icons to display on the web page.
    aLUIObject = SODIInfraSOMgrSO.SelectLUIObject(LUIObject_ID);
    aBinaryData.SetAllocatedSize(aLUIObject.ClosedLargeIconSize);
    aStream.Open(accessMode = SP_AM_READ_WRITE, isBinary = TRUE);
    aStream.WriteSerialized(object=aLUIObject.ClosedLargeIcon);
    aStream.Seek(0);
    aStream.ReadBinary(target = aBinaryData);
    // Not sure what MIME type to specify here for ImageData objects
    // read in from a database. Any ideas??????????
    Response.AssignBinaryResponse(aBinaryData, 'image/x-bitmap');
    return Response;
    ===============================================================
    Thanks,
    Brendan Duddridge

    Hello Denis Segard,
    I also try the same method and I use OLE container to store the images into database in Oracle forms 6i.
    But, if i try to retrieve the images in report i got that error.
    Anyway i store the images into the database but why i shouldn't retrieve it in reports and i can retrieve the images in forms
    Is there any problem in my design.
    Is there any other easy way to store the images into database in oracle forms 6i...
    Waiting 4 ur reply!!!!!!!!
    Edited by: Janarthan on Aug 19, 2011 12:36 AM
    Edited by: Janarthan on Aug 19, 2011 12:39 AM

  • Entity Framework doesn't save new record into database

    Hy,
    I have problem with saving new record into database using Entity Framework.
    When I run program, everything seems normal, without errors . Program shows existing, manually added records into the database, and new one too. But new one isn't save into database after running program.
    I've got no idea where's problem. There is code for add new record, show existing.
    Thanks for help!!
    // add new record
    using (var db=new DatabaseEntitiesContext())
    var person = new Table()
    First_Name = "New_FName",
    Second_Name = "New_SName",
    PIN = "4569"
    db.Tables.Add(person);
    db.SaveChanges();
    //show all records
    using (var db=new DatabaseEntitiesContext())
    var selected = from x in db.Tables
    select x;
    foreach (var table in selected)
    Console.WriteLine("{0}{1}{2}",table.First_Name,table.Second_Name,table.PIN);

    Hi BownieCross;
    If you are using a local database file in your project the following may be the cause.
    From Microsoft Documentation:
    Issue:
    "Every time I test my application and modify data, my changes are gone the next time I run my application."
    Explanation:
    The value of the Copy
    to Output Directory property is Copy
    if newer or Copy
    always. The database in your output folder (the database that’s being modified when you test your application) is overwritten every
    time that you build your project. For more information, see How
    to: Manage Local Data Files in Your Project.
    Fernando (MCSD)
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects
    and unknown namespaces.

Maybe you are looking for