Capture image with webcam using flash and sending it to the server

I have a need to use flash to capture an image and have that image uploaded to the server. I have seen some examples of code that uses flash to capture an image but it saves the file locally. We need that file to be sent to the server. We are using CF9.0 and I figure that once we are able to capture the image we could hand it off to ColdFusion to send to the server.
Has anyone done anything like that or know if it's possible?
Any help is apprecaited.
Thanks,
Mallory

It's not that hard...after you capture the image in Flash encode just send it via Remoting to a cfc as a bytearray or a bytearray encoded as Base64 string (and then decode it to binary in the CFC). I have had better luck with the latter way. You could also post the bytearray encoded as a Base64 string to a .cfm page as a form field.
For example in Action Script 3 you do something like this (assuming "frameBMD" is the BitmapData drawn from the video source):
var ba:ByteArray=com.adobe.images.PNGEncoder.encode(frameBMD);
var baAsString:String=com.dynamicflash.util.Base64.encodeByteArray(ba);
var saveImageResponder:Responder=new Responder(onSaveImageResult,onFault);
var rs=new NetConnection();
rs.objectEncoding=flash.net.ObjectEncoding.AMF3;
rs.connect("/flashservices/gateway");
rs.call("Headshot.saveImage",saveImageResponder,baAsString,1);
And your cfc would be something like this:
<cfcomponent displayName="Headshot" hint="Save a Headshot">
<cffunction name="saveImage" access="remote" output="false" returntype="string" roles="user">
  <cfargument name="data" type="string" required="true" />
  <cfargument name="user_id" type="numeric" required="no" default="1">
  <cfset SavePathParent = ExpandPath("/data/users")>
  <cfset SavePath = SavePathParent & "/user_" & arguments.user_id>
  <cfif NOT DirectoryExists(SavePath)>
    <cfdirectory action = "create" directory = "#SavePath#" mode="777">
  </cfif>
  <cfset theFilePath="#SavePath#/headshot_#arguments.user_id#.png">
<!--- Write the file --->
  <cffile action="write" file="#theFilePath#" output="#toBinary(arguments.data)#"/>
  <cfset LOCAL.file_url="/data/users/user_#arguments.user_id#">
  <cfreturn LOCAL.file_url/>
</cffunction>
</cfcomponent>
Anyway, that's the idea... hope that helps.

Similar Messages

  • Capture image with webcam: how to change image orientation

    Hi all,
    I have taken the code shown in thread http://forum.java.sun.com/thread.jspa?threadID=570463&tstart=0, and it works ok (many thanks for it).
    However, all webcam resolutions are in "landscape" mode (e.g. 320 x 240), but I would like to capture a "portrait" image (e.g. in 240 x 320).
    Do you know any easy way to do it (but not physically tilting the camera, so that the video in the screen is shown in its correct orientation)?
    Best regards.

    Hi Owen,
    in my current application I don't need right now to use any large image, so that I have decided to implement a "simple" solution as the first one that you appointed: to use a transparent rectangle above the image, and then crop the saved image withing the limits of this rectangle.
    In order to do it, I have modified your code so that the panel (visualContainer) where to show the image is using an OverlayLayout format:
    <address>visualContainer = new JPanel();</address>
    <address>OverlayLayout overlay = new OverlayLayout(visualContainer);</address>
    <address>visualContainer.setLayout(overlay);</address>
    I have added one class to create the transparent rectangle, using a code like this:
    class TopPanel extends JPanel
    Point loc;
    int width, height;
    public TopPanel()
    setOpaque(false);
    width = 50;
    height = 50;
    protected void paintComponent(Graphics g)
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D)g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
    RenderingHints.VALUE_ANTIALIAS_ON);
    if(loc == null)
    init();
    g2.setPaint(Color.blue);
    g2.drawRect(loc.x, loc.y, width, height);
    private void init()
    int w = getWidth();
    int h = getHeight();
    loc = new Point();
    loc.x = (w - width)/2;
    loc.y = (h - height)/2;
    In order to show the rectangle, what I have done is to add a TopPanel() to visualContainer just before adding the Player visualComponent.
    However, by doint in this way, the rectangle is not shown, but only the webcam image. I don't know if I'm doing something wrong, so any help on this issue is welcome.
    Best regards,
    izk

  • Classcast exception while sending objects to the server

    I'm getting classcast exception when i try to send objects from the java webstart application at the client side to a server. Its working fine if I do the same without using javaweb start. I'm using hessian client to send objects to the server.
    I've a web app that gets outlook contacts from the client machine and send those to the server. I'm sending these contacts as custom objects(OutlookContact) to the server using hessian client. But these objects are being sent to the server as String objects but not as OutlookContact objects. I don't know whats happening. Can anyone please tell me is there any setting that I need to set in the jnlp file.
    thanks,
    Jayaram

    I am also getting the same error. Please anybody can help

  • Hello guys..does anybody know how to install and use adobe master collection with the new lion?   I need to use Flash and illustratore, but apparently those programmes are incompatible with the new operative sistem...   I am a new mac users and I'd like t

    Hello guys..does anybody know how to install and use adobe master collection with the new lion?
    I need to use Flash and illustratore, but apparently those programmes are incompatible with the new operative sistem...
    I am a new mac users and I'd like to know if there are other similar programmes I can use with lion!

    Lab79 wrote:
    Are you on Apple's payroll?
    well dude I can only let you know that as I work with those programme I don't have to pay for it is my company that pays the programme I whant to use( that's why I was asking if there where other programmes ..that I could use with lion insted that Illustrator and Flash!)..I know Adobe since 2005 and I can say that Adobs products are very good...I think that if it's an Adobe probleme or fault ..they will solve it very soon...but unfortunally I have the impression that after Jobs passed away Appel decided to change politics..and everything started to go very bad! (see FCP X)..
    good luck with apple dude..
    Where is the Apple problem? I have CS4 and CS5 running perfectly fine on my Macbook Pro. Installed 5 after Lion upgrade. Worth every cent. Adobe did have some catching up to do with Lion but with the CS5.5 update all runs fine. But not yours. So it is a problem with the Lion OS? You say you have been with Adobe since 2005. So you would be aware of all the other issues that Adobe had catching up with past Oss in Mac and Windows then. They get it right, but it is up to them. It is not up to Apple, nor Microsoft for that matter, to run around and check that every software developer in the world is running their business properly.
    And what has politics got to do with anything. Some people just have to blame Software for their poor Hardware maintainence of failure of the same.
    <The only think I can really do is to go back on my old windows...give back this orrible lap top and ask for my money back!>
    Great suggestion. You should go with that one, but good luck getting a refund.
    Bye

  • Showing various images on browser using JSP and Servlet

    Hello Guys!
    I am starting to develop in Java and already I am facing a big problem.
    If somebody will have some tip or suggestion, will be very well comings!
    The application must present in browser images originnally of format TIF. As it is not a native format of the I.E. , I converted the image for JPG (without saving it on disk) and send it to the browser a encoded image (encode) using JAI library in one servlet had access by a JSP. Then, the structure of my application is thus:
    1) an archive JSP draws the initial screen in browser and presents one input text.
    2) later that the user places the parameter, I make an access to the database and read a quantity of images to be presented.
    3) From there in the proper JSP, I use de tag img src to send image to the browser in agreement archive the amount of images.
    It follows the code of the JSP:
    <% 
                    int intI=0;
                    int intCont=0;
                    if(blnImagem == true){
                        out.println("<br>");
                        out.println("<table border=0 STYLE=border-collapse:collapse>");
                        out.println("<tr>");
                        for(intI=0;intI < Processo.intQtdImagens;intI++){
                           Imagem.strImgTif = Imagem.IndicarImagem(Processo.strNmPath,Processo.strSubPath,Processo.intNuImagem,intI);                                                                    
                           out.println("<th>");
                           out.println("<table border=1 STYLE=border-collapse:collapse rules='cols'>");
                           out.println("<tr>");
                           out.println("<th>");
                           %>
                             <img src="ShowImg" WIDTH=100>
                           <%
                           out.println("</th>");
                           out.println("</tr>");
                           out.println("</table>");
    %>and code on the ShowImg servlet:
            response.setContentType("image/jpeg");       
            ServletOutputStream sos = response.getOutputStream();
            RenderedOp src = JAI.create("fileload", Imagem.strImgTif);           
            ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG",sos,null);       
            encoder.encode(src); 
            sos.close();The problem is if I have 10 images to present, it WILL BE it is executed 10 times and it passes 10 names of different archives, but in the page only the last image is presented 10 times. It is as if it processed the TAG to the end of everything in way that the value of the static variable Imagem.strImgTif was chore only with the last value and the same loaded image 10 times. How I make to solve this? Somebody has some idea?
    THANK YOU !
    Emidio

    If I understand correctly what your problem is:
    Do this in the jsp:
    out.println("<img src=\"ShowImg?image=" + intI + "\" WIDTH=100>");
    In the image servlet, get the "image" parameter and parse it as an int. Move the Imagem.IndicarImagem() call to the image servlet.

  • How to capture signature on mobile and send it to the bapi

    Hi all,
    I developed an Mobile application(7.1) in which signature capture should be there.
    1)How to capture this signature and send it to the backend .
    2)How I have to define the function module for this requirement?
    Thanks and regards,
    Rajesh

    Hi Rajesh,
    Here are the steps:
    1. First, you have a signature capture tool. Most of the phones come with their own signature capture tools. For example, for Pocket PC - you can go to the MSDN site and then download the capture program.
    2. The captured signature should then be stored as an JGP/ PDF/ or any version.
    3. In your mobile application, you have to convert this file into binary format. This must be uploaded to the mobile middleware
    In the mobile middleware, you must ensure that attachments are enabled. You can refer to this [link |https://www.sdn.sap.com/irj/scn/wiki?ath=/display/mobile/createapplicationsusingBinaryMemoandTextMemoinNetweaverMobile+7.1] for actions that you must do in the middleware and in the back-end.

  • Firefox upon opening an image in a new tab, centers the image from top and bottom and surrounds the image with a grey frame. Just started having the problem today, searched Google to no avail.

    Firefox upon opening an image in a new tab, centers the image from top and bottom and surrounds the image with a grey frame. Just started having the problem today, searched Google to no avail.

    Oh wow, looks like a new feature.
    The "page" links in a stylesheet with the address "resource://gre/res/TopLevelImageDocument.css". If you remove that reference, then the image displays in the old style.
    '''''Edit: Please skip the rest of this post and check out the next one.'''''
    There might be a more elegant solution than that, but you could use a bookmarklet to strip out that link when you want to view the page in its old style. A bookmarklet is a snippet of JavaScript you save on the Bookmarks toolbar for quick access.
    First, copy the following code to the clipboard (it's all one long line):
    <br>javascript:var ssheet=document.querySelector('link[href="resource://gre/res/TopLevelImageDocument.css"]'); if(ssheet)ssheet.parentNode.removeChild(ssheet); void 0;
    Next, if you are not displaying the Bookmarks Toolbar, use View > Toolbars > Bookmarks Toolbar to display it. (If you aren't using the classic Menu bar, press Alt+v to call up the old View menu. Right-clicking the gray area just below the page address also allows you to display the Bookmarks Toolbar.)
    Right-click on the Bookmarks Toolbar (or Mac equivalent of right-click!) and choose New Bookmark.
    Paste the code into the Location box (the second box).
    Then type a useful name in the Name box (e.g., Oldstyle Picture) and click Add.
    Now, when you want to tweak the image display, click the button to run the script.
    Manual clicking is a hassle, so it might make sense to look into other solutions. (Greasemonkey didn't seem to work; I think it might not run on .jpg files.)

  • Every tune in my library is marked with an explanation mark and produces a report " The song ..... could not be used because the original file could not be found. Would you like to locate it?"  Probably yes - but how ?

    Every song in my library, both purchased or downloaded from a CD, is marked with an exclamation mark and produces a report " The song ......... could not be used because the original file could not be found.  Would you like to locate it ?"     Well, probably yes - but how ? and why necessary ?  HELP !

    It would help to have more background about your iTunes collection such as if you keep it on an external drive, or if you have moved or renamed anything recently.  iTunes is very sensitive to you renaming or moving files or folders involved with your media.  iTunes only keeps a reference to where a media file is located  and then goes to look for it when you try to play it. If you have changed things since it was added to itunes then it's like me sending you to look for a friend in my addressbook but that friend has moved.
    The other possibility is your computer is starting to lose files.  Again, the computer uses a reference database to tell it where on the drive to look for a file. If that database gets corrupt then it starts losing files.  Use Dsk Utility's first aid to verify your hard drive.

  • HT201210 i updated my 4s yesterday, but my phone will not work at all now, and will not turn off. It has a itunes image on the screen with an arrow undernieth and what looks like the charger lead. i've had it on charge! is there anything else i can do?

    i updated my 4s yesterday, but my phone will not work at all now, and will not turn off. It has a itunes image on the screen with an arrow underneath and what looks like the charger lead. i've had it on charge! is there anything else i can do?

    Cconnect it to your computer with the latest version of iTunes installed.

  • I updated to yosemite and now if someone is using imessage and sends a text message to my phone it doesn't show up on my phone but does on my computer.  I don't want messages on my computer!  How do I get this to go away and work like it used to?

    I updated to yosemite and now if someone is using imessage and sends a text message to my phone it doesn't show up on my phone but does on my computer.  I don't want messages on my computer!  How do I get this to go away and work like it used to?

    Follow the instructions under the heading "How to unlink a phone number" on this page.

  • I am trying to change my email address for an Apple ID and it is saying that it is already in use. I then sign in with that Apple ID and it says that the account is not set up yet, I don't want to set up the account, but I do want to use the email address

    I am trying to change my email address for an Apple ID and it is saying that it is already in use. I then sign in with that Apple ID and it says that the account is not set up yet, I don't want to set up the account, but I do want to use the email address in my original Apple ID! HELP!

    Welcome to the Apple community.
    Once you have created a rescue address, you cannot delete it, nor can you change it to the same address as used by your ID. There are numerous providers you can get additional email addresses from, such as Hotmail, Yahoo, Google etc etc.

  • I am going to buy a mac mini i7 with 3 thunderbolt displays for forex trading. the question is if i use bootcamp and run windows on the mac mini will the displays still run the same way as if i was running it on Lion?

    I am going to buy a mac mini i7 with 3 thunderbolt displays for forex trading. the question is if i use bootcamp and run windows on the mac mini will the displays still run the same way as if i was running it on Lion?

    No idea if Windows will do it, but you can run Windows without Bootcamp & have OSX available at the same time, which should give you all the Monitors that OSX uses.
    Parallels...
    http://www.parallels.com/
    VmWare Fusion...
    http://www.vmware.com/mac

  • I have a scenario. Import IDOC into PI and PI transform IDOC to Excel. Using mail adapter attach that Excel using pi and send to customer. Can you please help me on the same?

    HI Experts,
    I have a scenario. Import IDOC into PI and PI transform IDOC to Excel. Using mail adapter attach that Excel using pi and send to vendor. Can you please help me on the same?
    Thanks
    SaiSreevastav

    Hi Sai,
    you can use XSLT or java mapping or adapter module to convert IDOC xml to XLS. Please refer the below blog
    Convert incoming XML to Excel or Excel XML – Part 1 - XSLT Way
    Convert incoming XML to Excel Sheet Part 2 – Adapter Module way
    Convert incoming XML to Excel Sheet
    then after converting to Excel, you can use the payloadswap bean in mail adapter
    XI: Sender mail adapter - PayloadSwapBean - Step by step
    regards,
    Harish

  • I am creating a slideshow with elements using photos and videos but the video sound doesnt play?

    I am creating a slideshow with elements using photos and videos but the video sound doesnt play?

     Hello jive
         I am playing it back in the slideshow editor/setting up part of
    programme where you determine photos/video to be included gaps between
    slides, music to play etc This goes through each phot and when comes
    to a video the background sound doesnt play, I am using windows 7 and
    elements 10.
         regards gins51

  • I use a Flexislider for my website [url removed] I want to use flash and make my website attracti

    I use a Flexislider for my website [url removed] I want to use flash and make my website attractive. Any suggestions?

    Will people be able to login to the FTP server from my website and do everything through their browser?
    Users could use web based ftp client or a 3rd party ftp client.
    Have look at the sytem the following school uses.
    http://www.glenbard.net/Glenbard_DistrictHQ/Media/MOVs/Web-BasedFTPClient.html
    Although I have not setup this type of thing up myself googling around shows a few tutorials using PHP or Java based ftp clients.
    have a look at this article..

Maybe you are looking for

  • Need help transferirng photos!

    How do I upload photos and videos from my iphone5 to a windows 8 pc?

  • Org.eclipse.jdt.launching.localJavaApplication Error

    I was developing nicely on Web Sphere Studio Developer Version=5.1.0 (with eclipse Release 2.1.1) but I just started getting the error "No Tab group defined for launch application type/n org.eclipse.jdt.launching.localJavaApplication" when trying to

  • New Page in NR19 transaction

    In alv list display of the NR19 transaction, how to trigger new page automatically depending of the order type. By example: a new page every time that change the attending physician.

  • Is there an alternative for Adobe Flash for Mac & Firefox

    Running Mac OS 10.6.8 Snow Leopard with Firefox 13.0. Was notified that I needed to install Adobe Flash/Shockwave to see video content. Have loaded and updated to the newest version as of last week but Firefox has become buggy, freezing up but my poi

  • Camera flash- photo turning out all white and blurry

    Every time i take a photo w the iphone 4s if the flash is on or even if the flash is set on auto  it shows up all white and you can not see the photo and it's blurry. Is there a way to adjust the flas strength?