Announcement

Collapse
No announcement yet.

Save WebCam Image in Image Field for save

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Save WebCam Image in Image Field for save

    Hi
    i could successfully catch a webcam videostream in an element. When i click the video show in the form i do:
    Code:
         videostream.pause();
    		var foto = document.getElementById('id_ajax_img_foto');
    		var context = canvas.getContext('2d');
    		context.drawImage(videostream, 0, 0,240,320);
    		var data = canvas.toDataURL('image/png');
    		foto.setAttribute('src', data);  ==> NOT SAVE IN DB WHEN PRESS SAVE
                    document.getElementById('myTextField').value="NewValue"; ==> SAVED IN DB WHEN PRESS SAVE
    The picture is displayed in the form field "foto", but when i presse the save button, the picture is not save in the db. Every other form field like textfields i can access, set a new value with document.getElementById('myTextField').value="NewV alue" and when i presse the save button, the newvalue is in the db. But not with the image...

    Any idea very welcome!

    Best regards
    Steve

  • #2
    No one have any idea?

    Comment


    • #3
      Why dont you save the image as a temporary file then and then store it yourself using php?

      Comment


      • #4
        Hi
        because i don't like to code twice... But okay, i can do my own ajax receiver on the server side and send the content from the pic to that. No problem.
        How does sc handles the picture field? With every other field i can set the content and when the user save, the new content is saved. Connect to scriptcase is the smarter way.

        Best regards
        Steve

        Comment


        • #5
          The picture is retrieved from the database. Storing the picture is done by uploading! it using a file/image field. It then gets stored in the the temporary directory as a temporary image file. But the storage is not as one would expect, there is something added in front of the data when it is written into the database. This is to identify the image.
          So if you want to save it you should save the contents. Just putting a picture on the client side without saving it will not really work.
          Personally I advise AGAINST storing images in a database. It will make your database grow quickly. You can just as easily store it in a directory. That way if there is a lot of pictures you should be able to spread the load of images over several drives.
          Last edited by rr; 06-09-2015, 04:29 AM.

          Comment


          • #6
            But how...?

            Hi
            storing pics in a db or in the filesystem (which is also a db) is not part of this thread.

            But how can i store a picture in a js-variable to the database?

            Of course, i can make my own code on server and client side to handle that. But sc handles that very well allready. Is it somewhere documented how sc stores the picture or do i have to do reverse engineering?

            Best regards
            Steve

            Comment


            • #7
              Hi
              my problem still exists: I have picture data in a js variable on the client. I also have a db-image field in SC that i want to update with my picture in the js variable. How can i send this now to the server? Can i use the ajax methods sc has allready built in or do i have to write my own code and refresh the form to show the stored data from my code?

              Any help very welcome! Thanks!

              Best regards
              Steve

              Comment

              Working...
              X