File saveAsOpen and Base64 encoding...

In order to send the activeDocument to a web service, i need to save is as a file image, and send in an xml format.
Thus, i also need to encode it in Base64.
At this point everything is OK.
But between the saveAs of the file, its reopening, and its encoding, its corrupted.
I receive an error on the Mongrel server.
The Base64 encoder seems to work well, the rest of the code seem to be also ok, so I think my problem is either I do not save it correctly, either i do not reopen it correctly...
Please save me :(
Here is the code :
          /* STEP 1 : save current document as image file (temporary) */
          var docRef = activeDocument;
          var filepath=app.path.toString()+"/"+docRef.name+".jpg";//create the image file in the installation folder of Photoshop
          var file = new File(filepath);
          //var options = new ExportOptionsSaveForWeb();
          //options.format = SaveDocumentType.PNG;
          var options = new JPEGSaveOptions();
          options.quality=8;
          docRef.saveAs (file, options, true, Extension.LOWERCASE);
          //docRef.exportDocument (file, ExportType.SAVEFORWEB , options);
          file.close();
/* I code here dialogBox and httpCOnenction object creation
that do not need to be written here
(but if you think it's important, i can give you the full script)
          var f= new File(filepath);
          f.open();
          var buffer = f.read(f.length);
          f.close();
I build an HttpConnection object called "send"
*/                 send.request='"+f.name+""+f.length+""+base64encode(buffer)+"';
Here is the Server error :
Exception working with image: Not a JPEG file: starts with 0xc7 0xff `/var/folders/Nz/NzlixjchF+WAvFkZK9vVRU+++TM/-Tmp-/test599-0.jpg'

Let's give you everything in fact, it will be more simple (by the way the code is suppose to become OpenSource)<br /><br />I work on Mac, Photoshop CS3 (10.0.1)<br />I use JavaScript<br />HTTP request received by a Mongrel server (Ruby on Rails)<br /><br />// Copyright 2008. Studio Melipone. All rights reserved. <br />// Licence GNU LGPL<br />// Send the active document to the UpShot web service (http://upshotit.com)<br />//  The document is sent as a .png file, as a draft on the user's account.<br />// Therefore you must have a document opened and Adobe Bridge installed to perform this script.<br /><br />/*<br />     <javascriptresource><br />          <name>UpShot</name><br />          <type>automate</type><br />          <about><br />          Script for Upshot <br />          Copyright 2008 Studio Melipone <br />          http://upshotit.com <br />          </about><br />          <enableinfo>true</enableinfo><br />     </javascriptresource>     <br />*/<br /><br />#target photoshop<br />#include "Base64.jsx"<br /><br />app.bringToFront();<br /><br />if( documents.length==0)// is a document opened ?<br />     alert("There are no Photoshop documents opened !")<br />else {<br />          /*********************************************/<br />          /* STEP 1 : save current document as image file (temporary) */<br />          /******************************************/<br />          var docRef = activeDocument;<br />          var filepath=app.path.toString()+"/"+docRef.name+".jpg";//create the image file in the installation folder of Photoshop<br />          var file = new File(filepath);<br />          //var options = new ExportOptionsSaveForWeb();<br />          //options.format = SaveDocumentType.PNG;<br />          var options = new JPEGSaveOptions();<br />          options.quality=8;<br />          docRef.saveAs (file, options, true, Extension.LOWERCASE);<br />          //docRef.exportDocument (file, ExportType.SAVEFORWEB , options);<br />          file.close();<br />          <br />          /********************************************************/<br />          <br />     // Only Bridge can use HttpConnection, so we test if it is installed<br />     var bridgeTarget = BridgeTalk.getSpecifier(getAppSpecifier("bridge")); <br />                    <br />     if( !bridgeTarget ) { <br />          alert("Adobe Bridge not installed, needed to continue."); <br />     } <br />     else {     <br />          preferences.rulerUnits = Units.PIXELS;<br />          displayDialogs = DialogModes.NO;<br />          <br />          /**********************************/<br />          /* STEP 2 : retrieve user's login & password */<br />          /*******************************/<br />          <br />          res = "dialog { text: 'UpShot authentication', \<br />                         info: Panel { orientation: 'column', alignChildren:'right', \<br />                                             text: 'Please Identify Yourself', \<br />                                             login: Group { orientation: 'row', \<br />                                                  s: StaticText { text:'Login :' }, \<br />                                                  e: EditText { characters: 30 } \<br />                                             }, \<br />                                             passwd: Group { orientation: 'row',  \<br />                                                  s: StaticText { text:'Password :' }, \<br />                                                  e: EditText { characters: 30, properties:{noecho: true} }, \<br />                                             } \<br />                                   }, \<br />                         buttons: Group { orientation: 'row', \<br />                                        okBtn: Button { text:'OK', properties:{name:'ok'} }, \<br />                                        cancelBtn: Button { text:'Cancel', properties:{name:'cancel'} } \<br />                         } \<br />                    }"; <br />          <br />          dlg = new Window (res); <br />          dlg.center(); <br />          dlg.show(); <br /><br />          var login = dlg.info.login.e.text;//retrieve the values given in the form<br />          var pass = dlg.info.passwd.e.text;<br /><br />          /******************************/<br />          /* STEP 3 : send image through Bridge */<br />          /***************************/<br />          var f= new File(filepath);<br />          f.open();<br />          var buffer = f.read(f.length);<br />          f.close();<br />          <br />          alert("file size "+file.length);<br />          alert("f size "+f.length);<br />          alert("BUF "+buffer);<br />          alert(base64encode("B64 "+base64encode(buffer)));<br />          <br />          // create a new BridgeTalk message object <br />          var bt = new BridgeTalk; <br />          // target the Adobe Bridge application <br />          bt.target  = bridgeTarget; <br />          //p173 of Javascript Tools Guide for CS3 for http message<br />          bt.body = "\<br />               if(!ExternalObject.webaccesslib ) {\<br />                    ExternalObject.webaccesslib = new ExternalObject('lib:webaccesslib');\<br />               }\<br />               var http = new HttpConnection('http://127.0.0.1:3000/en/users/get_id.xml') ; \<br />               var idfile = new File('"+app.path.toString()+"/id.xml') ;\<br />               http.response = idfile ; \<br />               http.username = '"+login+"';\<br />               http.password = '"+pass+"';\<br />               http.mime='text/xml';\<br />               http.responseencoding='utf8';\<br />               http.execute();\<br />               http.response.close();\<br />               http.close();\<br />               idfile.open();\<br />               var send = new HttpConnection('http://127.0.0.1:3000/en/users/'+idfile.read()+'/upshots') ; \<br />               send.method = 'POST';\<br />               send.username = '"+login+"';\<br />               send.password = '"+pass+"';\<br />               send.mime='text/xml';\<br />               send.requestheaders=['Host','http://localhost:3000'];\<br />               send.requestheaders=['Accept','*/*'];\<br />               send.requestheaders=['Content-Type','text/xml'];\<br />               send.request='<upshot><title>titleforyourimage</title><file_name>"+f.nam e+"</file_name><size>"+f.length+"</size><javafile>"+base64encode(buffer)+"</javafile></ups hot>';\<br />               send.execute();\<br />               idfile.toSource();\<br />          ";<br />          <br />          bt.onResult = function(result) { <br />               object = bt.result = eval(result.body);<br />               //file.remove();<br />               //object.remove();<br />               //bridge.quit ();<br />               return eval(result.body); <br />          } ;<br />          <br />          bt.onError = function( message ) { <br />               var errCode = parseInt (message.headers ["Error-Code"]); <br />               throw new Error (errCode, message.body); <br />          } ;<br />                    <br />          //send the message ( also launch the targetted application)<br />          bt.send(10);<br />     <br />     /**********************************************/<br />     /* STEP 4: Once all done, delete the image previously created */<br />     /*******************************************/<br />     }<br />}<br /><br />//////////////////////////////////////////////////////////////////<br />/////////////////////////////////////////////////////////////////<br />/*functions from http://www.ps-scripts.com/bb/viewtopic.php?t=1282 */<br />//////////////////////////////////////////////////////////////<br />/////////////////////////////////////////////////////////////<br /><br />function getAppSpecifier(appName) {<br /><br />   if (isCS2()) {<br />      if (appName == 'photoshop') {<br />         return 'photoshop-9.0';<br />      }<br />      if (appName == 'bridge') {<br />         return 'bridge-1.0';<br />      }<br />      // add other apps here<br />   }<br /><br />   if (isCS3()) {<br />      if (appName == 'photoshop') {<br />         return 'photoshop-10.0';<br />      }<br />      if (appName == 'bridge') {<br />         return 'bridge-2.0';<br />      }<br />      // add other apps here<br />   }<br /><br />   return undefined;<br />};<br /><br />function isCS2() {<br />   var appName = BridgeTalk.appName;<br />   var version = BridgeTalk.appVersion;<br /><br />   if (appName == 'photoshop') {<br />      return version.match(/^9\./) != null;<br />   }<br />   if (appName == 'bridge') {<br />      return version.match(/^1\./) != null;<br />   }<br /><br />   return false;<br />};<br />function isCS3() {<br />   var appName = BridgeTalk.appName;<br />   var version = BridgeTalk.appVersion;<br /><br />   if (appName == 'photoshop') {<br />      return version.match(/^10\./) != null;<br />   }<br />   if (appName == 'bridge') {<br />      return version.match(/^2\./) != null;<br />   }<br /><br />   return false;<br />};

Similar Messages

  • Problem with base64 encoding an xml file with accented characters

    Oracle 10.2.0.1.0 Enterprise Edition running under windows 2003 server
    DB Characterset UTF-8
    I have a routine which takes an xml file and base64 encodes it, and the base64encoded text is stored in a clob column of a table.
    The xml file is stored in UTF-8 format.
    The routine works correctly, except when there are accented characters.
    I am using dbms_lob.loadclobfrom file to load the file.
    DBMS_LOB.OPEN(src_clob, DBMS_LOB.LOB_READONLY);
        DBMS_LOB.LoadCLOBFromFile(
              DEST_LOB     => dest_clob
            , SRC_BFILE    => src_clob
            , AMOUNT       => DBMS_LOB.GETLENGTH(src_clob)
            , DEST_OFFSET  => dst_offset
            , SRC_OFFSET   => src_offset
            , BFILE_CSID   =>dbms_lob.default_csid
            , LANG_CONTEXT => lang_ctx
            , WARNING      => warning
        DBMS_LOB.CLOSE(src_clob);base 64 encoded xml with accented character -- incorrect
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxncDpBcHBs
    aWNhdGlvblByb2ZpbGUgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAx
    L1hNTFNjaGVtYS1pbnN0YW5jZSINCiAgICB4c2k6c2NoZW1hTG9jYXRpb249Imh0
    dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2Zp
    bGVzLzEuMS4wIGh0dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9z
    eXN0ZW1zLXByb2ZpbGVzLzEuMS4wL0dQLnN5c3RlbXMucHJvZmlsZXMuMS4xLjAu
    QXBwbGljYXRpb25Qcm9maWxlLnhzZCINCiAgICB4bWxuczpncD0iaHR0cDovL25h
    bWVzcGFjZXMuZ2xvYmFscGxhdGZvcm0ub3JnL3N5c3RlbXMtcHJvZmlsZXMvMS4x
    LjAiDQogICAgVW5pcXVlSUQ9Ik1FIiBQcm9maWxlVmVyc2lvbj0iMS4xLjAiIEVy
    cmF0YVZlcnNpb249IjAiPg0KICAgIDxncDpEZXNjcmlwdGlvbj5Gb3J1bSBUZXN0
    PC9ncDpEZXNjcmlwdGlvbj4NCiAgICA8Z3A6RGF0YUVsZW1lbnQgTmFtZT0iw6Fj
    Y2VudCIgRXh0ZXJuYWw9InRydWUiIFR5cGU9IkJ5dGVTdHJpbmciIEVuY29kaW5n
    PSJIRVgiIEZpeGVkTGVuZ3RoPSJmYWxzZSIgTGVuZ3RoPSIxNiIgUmVhZFdyaXRl
    PSJ0cnVlIiBVcGRhdGU9InRydWUiIE9wdGlvbmFsPSJ0cnVlIiAvPiAgICANCjwv
    Z3A6QXBwbGljYXRpb25Qcm9maWxlPg0Kbase 64 encoded xml without accented character -- correct
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxncDpBcHBs
    aWNhdGlvblByb2ZpbGUgeG1sbnM6eHNpPSJodHRwOi8vd3d3LnczLm9yZy8yMDAx
    L1hNTFNjaGVtYS1pbnN0YW5jZSINCiAgICB4c2k6c2NoZW1hTG9jYXRpb249Imh0
    dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2Zp
    bGVzLzEuMS4wIGh0dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9z
    eXN0ZW1zLXByb2ZpbGVzLzEuMS4wL0dQLnN5c3RlbXMucHJvZmlsZXMuMS4xLjAu
    QXBwbGljYXRpb25Qcm9maWxlLnhzZCINCiAgICB4bWxuczpncD0iaHR0cDovL25h
    bWVzcGFjZXMuZ2xvYmFscGxhdGZvcm0ub3JnL3N5c3RlbXMtcHJvZmlsZXMvMS4x
    LjAiDQogICAgVW5pcXVlSUQ9Ik1FIiBQcm9maWxlVmVyc2lvbj0iMS4xLjAiIEVy
    cmF0YVZlcnNpb249IjAiPg0KICAgIDxncDpEZXNjcmlwdGlvbj5Gb3J1bSBUZXN0
    PC9ncDpEZXNjcmlwdGlvbj4NCiAgICA8Z3A6RGF0YUVsZW1lbnQgTmFtZT0iYWNj
    ZW50IiBFeHRlcm5hbD0idHJ1ZSIgVHlwZT0iQnl0ZVN0cmluZyIgRW5jb2Rpbmc9
    IkhFWCIgRml4ZWRMZW5ndGg9ImZhbHNlIiBMZW5ndGg9IjE2IiBSZWFkV3JpdGU9
    InRydWUiIFVwZGF0ZT0idHJ1ZSIgT3B0aW9uYWw9InRydWUiIC8+ICAgIA0KPC9n
    cDpBcHBsaWNhdGlvblByb2ZpbGU+DQo=the xml file in use is
    <?xml version="1.0" encoding="UTF-8"?>
    <gp:ApplicationProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://namespaces.globalplatform.org/systems-profiles/1.1.0 http://namespaces.globalplatform.org/systems-profiles/1.1.0/GP.systems.profiles.1.1.0.ApplicationProfile.xsd"
        xmlns:gp="http://namespaces.globalplatform.org/systems-profiles/1.1.0"
        UniqueID="ME" ProfileVersion="1.1.0" ErrataVersion="0">
        <gp:Description>Forum Test</gp:Description>
        <gp:DataElement Name="áccent" External="true" Type="ByteString" Encoding="HEX" FixedLength="false" Length="16" ReadWrite="true" Update="true" Optional="true" />   
    </gp:ApplicationProfile>The file is being loaded from a windows xp professional 32 bit system.
    If I just convert the xml text of the file using
    select utl_raw.cast_to_varchar2(
    utl_encode.base64_encode(
    utl_raw.cast_to_raw(
    '<?xml version="1.0" encoding="UTF-8"?>
    <gp:ApplicationProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://namespaces.globalplatform.org/systems-profiles/1.1.0 http://namespaces.globalplatform.org/systems-profiles/1.1.0/GP.systems.profiles.1.1.0.ApplicationProfile.xsd"
        xmlns:gp="http://namespaces.globalplatform.org/systems-profiles/1.1.0"
        UniqueID="ME" ProfileVersion="1.1.0" ErrataVersion="0">
        <gp:Description>Forum Test</gp:Description>
        <gp:DataElement Name="áccent" External="true" Type="ByteString" Encoding="HEX" FixedLength="false" Length="16" ReadWrite="true" Update="true" Optional="true" />   
    </gp:applicationprofile>'
    ))) from dual;I get the following
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGdwOkFwcGxp
    Y2F0aW9uUHJvZmlsZSB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEv
    WE1MU2NoZW1hLWluc3RhbmNlIgogICAgeHNpOnNjaGVtYUxvY2F0aW9uPSJodHRw
    Oi8vbmFtZXNwYWNlcy5nbG9iYWxwbGF0Zm9ybS5vcmcvc3lzdGVtcy1wcm9maWxl
    cy8xLjEuMCBodHRwOi8vbmFtZXNwYWNlcy5nbG9iYWxwbGF0Zm9ybS5vcmcvc3lz
    dGVtcy1wcm9maWxlcy8xLjEuMC9HUC5zeXN0ZW1zLnByb2ZpbGVzLjEuMS4wLkFw
    cGxpY2F0aW9uUHJvZmlsZS54c2QiCiAgICB4bWxuczpncD0iaHR0cDovL25hbWVz
    cGFjZXMuZ2xvYmFscGxhdGZvcm0ub3JnL3N5c3RlbXMtcHJvZmlsZXMvMS4xLjAi
    CiAgICBVbmlxdWVJRD0iTUUiIFByb2ZpbGVWZXJzaW9uPSIxLjEuMCIgRXJyYXRh
    VmVyc2lvbj0iMCI+CiAgICA8Z3A6RGVzY3JpcHRpb24+Rm9ydW0gVGVzdDwvZ3A6
    RGVzY3JpcHRpb24+CiAgICA8Z3A6RGF0YUVsZW1lbnQgTmFtZT0iw6FjY2VudCIg
    RXh0ZXJuYWw9InRydWUiIFR5cGU9IkJ5dGVTdHJpbmciIEVuY29kaW5nPSJIRVgi
    IEZpeGVkTGVuZ3RoPSJmYWxzZSIgTGVuZ3RoPSIxNiIgUmVhZFdyaXRlPSJ0cnVl
    IiBVcGRhdGU9InRydWUiIE9wdGlvbmFsPSJ0cnVlIiAvPiAgICAKPC9ncDphcHBs
    aWNhdGlvbnByb2ZpbGU+Edited by: Keith Jamieson on Jul 13, 2012 9:59 AM
    added code tag for last base64 encoded object

    Not sure if utl_i18n is already there in version prior to 11.2.0.2.
    But on above mentioned version I can do the simplified method
    SQL> SELECT utl_i18n.raw_to_char (
             utl_encode.base64_encode (
               xmltype (
                 '<?xml version="1.0" encoding="UTF-8"?>
    <gp:ApplicationProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://namespaces.globalplatform.org/systems-profiles/1.1.0 http://namespaces.globalplatform.org/systems-profiles/1.1.0/GP.systems.profiles.1.1.0.ApplicationProfile.xsd"
        xmlns:gp="http://namespaces.globalplatform.org/systems-profiles/1.1.0"
        UniqueID="ME" ProfileVersion="1.1.0" ErrataVersion="0">
        <gp:Description>Forum Test</gp:Description>
        <gp:DataElement Name="áccent" External="true" Type="ByteString" Encoding="HEX" FixedLength="false" Length="16" ReadWrite="true" Update="true" Optional="true" />   
    </gp:ApplicationProfile>').getblobval (
                 NLS_CHARSET_ID ('utf8'))),
             'utf8')
             x
      FROM DUAL
    X                                                                                                                                                    
    PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGdwOkFwcGxp                                                                                     
    Y2F0aW9uUHJvZmlsZSB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEv                                                                                     
    WE1MU2NoZW1hLWluc3RhbmNlIiB4c2k6c2NoZW1hTG9jYXRpb249Imh0dHA6Ly9u                                                                                     
    YW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2ZpbGVzLzEu                                                                                     
    MS4wIGh0dHA6Ly9uYW1lc3BhY2VzLmdsb2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1z                                                                                     
    LXByb2ZpbGVzLzEuMS4wL0dQLnN5c3RlbXMucHJvZmlsZXMuMS4xLjAuQXBwbGlj                                                                                     
    YXRpb25Qcm9maWxlLnhzZCIgeG1sbnM6Z3A9Imh0dHA6Ly9uYW1lc3BhY2VzLmds                                                                                     
    b2JhbHBsYXRmb3JtLm9yZy9zeXN0ZW1zLXByb2ZpbGVzLzEuMS4wIiBVbmlxdWVJ                                                                                     
    RD0iTUUiIFByb2ZpbGVWZXJzaW9uPSIxLjEuMCIgRXJyYXRhVmVyc2lvbj0iMCI+                                                                                     
    CiAgPGdwOkRlc2NyaXB0aW9uPkZvcnVtIFRlc3Q8L2dwOkRlc2NyaXB0aW9uPgog                                                                                     
    IDxncDpEYXRhRWxlbWVudCBOYW1lPSLDoWNjZW50IiBFeHRlcm5hbD0idHJ1ZSIg                                                                                     
    VHlwZT0iQnl0ZVN0cmluZyIgRW5jb2Rpbmc9IkhFWCIgRml4ZWRMZW5ndGg9ImZh                                                                                     
    bHNlIiBMZW5ndGg9IjE2IiBSZWFkV3JpdGU9InRydWUiIFVwZGF0ZT0idHJ1ZSIg                                                                                     
    T3B0aW9uYWw9InRydWUiLz4KPC9ncDpBcHBsaWNhdGlvblByb2ZpbGU+Cg==                                                                                         
    1 row selected.which encodes and decodes properly on my system even with accented characters.

  • Base64 encode attachments but not xml payload

    Hi Everyone,
    Using the soap adapter I know that I can use an adapter module and base64 encode everything. Is it possible to base64 encode the attachments but leave the soap/xml payload as text/xml?
    Regards,
    Joe

    > Using the soap adapter I know that I can use an adapter module and base64 encode everything. Is it possible to base64 encode the attachments but leave the soap/xml payload as text/xml?
    Do you want to have attachments of type base64, or do you want to have transfer-encoding base64? The latter is not possible with adapter modules.
    Regards
    Stefan

  • Get canvas.toDataURL('image/jpeg') and convert base64 encoding to java.sql.Blob

    Convert canvas.toDataURL('image/jpeg') to java.sql.Blob.
    I am using oracle adf so I am able to action a backing bean from javascript and pass in parameters as a map. I pass in the canvas.toDataURL('image/jpeg') which I then try to decode in my bean. Using BASE64Decoder and the converting the bytearray to a file I can see the image is corrupted as I can't open the file thus converting the bytearray to blob is also a waste.
    Has anyone any ideas on base64 encoding from canvas.toDataURL to file or Blob?

    Use Case:
    A jsf page that enables a user to take photos using the HTML5 canvas feature - interact with webcam -, take photos and upload to profile
    1. I have created the jsf page with the javascript below; this pops up as a dialog and works okay and onclick an upload image, triggers the snapImage javascript function below and sends the imgURL parameter to the serverside managedbean
    <!-- java script-->
    function snapImage(event){
                    var canvas = AdfPage.PAGE.findComponent('canvas');
                    AdfCustomEvent.queue(event.getSource(),"getCamImage",{imgURL:canvas.toDataURL('image/jpeg'),true);
                    event.cancel();
    <!-- bean -->
    public void getCamImage(ClientEvent ce){
    String url=(String)ce.getAttributes().get("imgURL");
    decodeBase64URLToBlob(url);
    private BlobDomain decodeBaseB4URLToBlob(String url64){
                    BASE64Decoder de=new BASE64Decoder();
                    byte[] bytes=de.decode(url64);
                    File file=new File("abc.jpg");
                    InputStream in = new ByteArrayInputStream(bytes);
                    BufferedImage bImageFromConvert = ImageIO.read(in);
                    in.close();
                    ImageIO.write(bImageFromConvert, "jpg", file);
                    return createBlobDomainFromFile(file);
    ----problem---
    Accessing the generated jpeg file shows the image is corrupted, probably missing bytes or encode/decoder issues.and the blob image after uploading to database is saved as a binary stream which ondownload doesnt render as an image or anything i know of.
    Is there anyways of achieving the conversion without errors?

  • Premier Pro CC and Media Encoder crashing on long file export.

    Please forgive the length of this inquiry. But it is complicated and has a lot of variables.
    I have an hour long mixed format timeline both Red 3K footage and Black Magic ProRes 1080P footage that I want to make a DVD from and it takes forever and crashes half way through. I have tried doing it every way possible and the only way I was able to get even a partial export was using the "MPEG 2 DVD" export option in Premier CC. It goes fast at first telling me it will take about 2 hours but even though it starts quickly doing about 15 fps it slows down to less than 1 fps and finally just stops and crashes my Cuda Core enabled Macbook Pro Laptop.
    I really don't know who to ask about this since there are so many different variables. I never had a problem like this on my MBP with PP6 on a 4K timeline exporting to DVD or Blue Ray or to H-264 or Even Prores. But I wasn't mixing formats either. But on this project the first 20-30 minutes of footage goes through fine in a couple of hours but something seems to be bogging down the system on longer projects. My work around was to break the project up into multiple exports and combining them on the DVD timeline but I can't do this on every project. I thought maybe it was a corrupted clip somewhere in the timeline but when I broke the timeline up into several parts I had no problems.
    I did notice a dramatic variance in the time it took to export footage based on the sequence settings. A one minute timeline comprised Red 3K footage and ProRes 1080P footage Here are some sample export results:
    From a Red raw 3K timeline 2880x1620  with 1080P Prores footage upscaled 150%)
    to .m2v Mpeg 2 720x480 format    1:48 Minutes ***
    to .mov  Prores 422HQ  1080P                         22 Minutes
    to .mov H.264  1080P                    22 Minutes
    to .m2v Mpeg 2 1080P                                                22 Minutes
    From a 1080P timeline Prores footage at 100%  (Red footage downscaled to 67%)
    to .m2v Mpeg 2 720x480 format                         13 Minutes
    to .mov  Prores 422HQ 1080P                             13 Minutes
    to .mov H.264  1080P                                                             14 Minutes
    to .m2v Mpeg 2 1080P                                                            14 Minutes
    Since I am going to DVD,  I chose the fastest option  Red to m2v Mpeg 2 720x480 format which only took 1:48 per minute. Why? I have no idea. Maybe someone here knows the answer. But again these numbers are for a ONE MINUTE clip when I tried to convert the whole hour timeline to  the 720x480.m2v DVD File the Red timeline froze my computer after several hours even though I had set sleep mode to “Never” and turned the display off manually and I had to convert it in multiple chunks. In 20-30 minute chunks it did go fast about 1:48 per minute like the test indicated. But I would like to be able to convert the whole hour and not to have to try to stitch the clips together in my DVD authoring program.
    I don’t want to have to avoid using multiple formats on the same timeline or waste time transcoding everything to the same format.
    Can anyone give me any suggestions as to why the computer is crashing or bogging down in long exports and what timeline settings I should be using?
    I have plenty of room on my Scratch Disk and 8 Gig of RAM and according to my Activity Monitor during the export process  have about 800 Meg of System Memory during export but the CPU Usage is 98% and in my Activity Monitor I see under “Process Name” ImporterRedServer flashing up at the top of the list about every second during export.
    Why .720x480 mpeg DVD setting is so much faster than all the other export codecs?
    And if there are any other settings I can use to get higher speed exports in HD? 14x1 seems a little slow especially since every time it crashes I have to start over.

    Hi,
    Since a long time I did not encounter the crash of Media encoder with
    long file export.
    But I take care of a lot of details before the export :
    - clean up Media cache and Media Cache Files within PP CS6 and/or CC,
    - delete all render files with Preview Files,
    - rendering of sequences until the rendering is completed,
    - PP CS6 and/or Pp CC opened during export to AME and/or Encore CS6,
    I guessed to leave Adobe but this company remains the last with a
    serious authoring software (Encore CS 6).
    I tested :
    - Avid Media Composer, Final Cut Pro X, both are very good software but
    no really authoring software for these video editing softs.
    Th only way is to "flood" Adobe with "bug reports" and "wish forms"
    which are not very easy to use.
    And also to call the Adobe support day by day until they send they
    escalate the bug.
    Le 16/05/2014 16:51, alainmaiki a écrit :
    >
          Premier Pro CC and Media Encoder crashing on long file export.
    created by alainmaiki <https://forums.adobe.com/people/alainmaiki> in
    /Premiere Pro/ - View the full discussion
    <https://forums.adobe.com/message/6384665#6384665>

  • Premiere and Media Encoder will will no longer export my edit to any file format.

    This is on a Windows 8.1 PC.
    The edit exported fine until I made one big mistake.
    I created a Nested Edit to make a quick alteration.
    Since then the following is now the case and I cannot go back to an earlier edit to fix this.
    Premiere and Media Encoder will will no longer export my edit to any file format. Using either the Export Option or Media Encoder.  Get a dialog that says "Unknown Error Compiling Movie"
    There is nothing wrong with my footage.  This edit worked fine and I export through Media Encoder many times until I made a Nested Edit within the Premiere Project.
    I have tried all sorts of searches on the net for a fix to this but nothing seems to be current or indeed works.
    Any help would be appreciated as this is a show stopper.

    Thanks for the reply Mark, appreciated.
    I have found a work around but it still leaves a long term issue for Adobe to fix.
    As to your first solution:
    1).  The nested edit is already in its own timeline panel.  It will not export or encode via media encoder.  This is the problem.
    2).  I will try the KEM roll feature but I have a work around see following.
    3).  No I do not have a nested edit within a nested edit.
    I did a lot of research on the net on this issue as it happened to a colleague of mine on his machine about two weeks ago.  It took me six hours to get a fix and in his case there were six video clip that had read errors.  When I overwrote those clips from the original backup master it fixed the problem.  However I was never able to use Media Encoder again to export his project without it failing.  I could only use the Export feature.  Again he had used a nested edit in his project.
    I my case I do not have any nested edits within a nested edit.  All I did was drag my main edit onto the New Sequence icon at the bottom of the Project Bin.  This of course created a nested edit in a new Timeline Panel which is what I wanted.  I then slid the entire nested edit to the right in the timeline by two seconds as all a wanted to do was add two seconds of black at the head of the edit.  That was it.  From that point of creating the nested edit Media Encoder and the Export option failed every time with the fore mentioned error.
    The final work around was one of those I found previous mention of during my research.  I created a new clean Premiere Pro CC 2014 project, I then used the import option under the file menu.  I imported only the original main edit which brought in that edit along with all the required footage.  This would then export to disk using the Export feature.  However, Media Encoder will still not encode this new edit, it fails the same way every time, 'Unknown Error Compiling Movie'.
    As a test I loaded the old corrupt edit project back up and deleted the nested edit sequence completely and re-saved it.  This had no effect and did not fix the problem.  This particular project file will no longer export directly or via media encoder at all no matter what I do.
    This seems pretty serious to me.  I worked on this edit for a whole month without issue, encoding out roughs as a went without any issue, it was only yesterday after I made the nested edit that the project file is now useless as it will not encode out at all.  Yes I have a work around and was able to salvage my project and get it rendered in time for my deadline but the fact I have a partially working Project that Media Encoder will not touch does not instill me with confidence for long term use of Premiere Pro if this is going to happen again.
    Is there some place I can send this project file to Adobe to see if they can find out what is wrong with it?  I am not the only person having this issue I have seen other post going all the way back through CS6 it seems.

  • Premiere and Media Encoder Crashing During Export of Quicktime Files

    Premiere CC and Media Encoder CC crashes when exporting Quicktime H.264 files. Sometimes the export will work, sometimes it crashes the app. After crashing, the app will freeze while loading "ExporterQuictimeHost.bundle" and requires a hard re-boot of the system to startup again.
    I have tried removing some Quicktime codecs from the Quicktime library folder, as suggested in other threads. This has not solved the problem.
    I am editing with Quicktime ProRes 4444 files.
    Any help on this would be greatly appreciated. Here's some system info:
    Mac Pro Mid 2010
    OS X 10.9.4
    2 x 2.66 GHz 6-Core Intel Xeon
    36 GB Memory
    NVIDIA Quadro FX 4800 1536MB
    Blackmagic DeckLink HD Extreme
    Cuda Driver Version 6.5.14
    Creative Cloud CC 2014

    I'm having similar problems. I can't export anything now...either from Premiere or from Media Encoder. My sequence is ProRes HQ, I am exporting using sequence settings.
    It gets about 75% of the way through and bails with this error message:
    Export Error
    Error compiling movie.
    Unknown error.
    That's really helpful. Addtionally, when I tried to export out of Media Encoder, I was greeted by an extremely loud bleating goat noise when it failed. Nice. I had a room full of clients. Thanks Adobe.
    I'm seriously doubting the claim of "Pro" at this point.
    This was not beta tested with a ****.

  • Since Firefox 4, I can get a background image to work using base64 encoded, but not a local file, this worked in Firefox 3, how do I resolve this.

    Using either of the 4 examples shown below, to have a background image display inside about:blank worked in Firefox 3.x (using Stylish add-on), however since Firefox 4, only using the base64 encoded version of images works. Is there any way to fix this so I don't have to encode every image I wish to use? Encoding the image makes the stylish file absolutely huge, & a real pain to keep encoding whenever I want to change the image.
    body:empty { background: url("resource:/res/images/OnFire.jpg")
    body { background-image: url("resource:/res/images/OnFire.jpg")
    body:empty { background:url("data:
    body { background-image: url("data:
    I've also previously disabled most of the add-ons, except for Status-4-Evar, Stylish, & Firebug, in an attempt to see if something else was interfering, but no change.
    I can supply a copy of the previously working (FF 3.x) code to some of the about:blank styles if needed for testing purposes.

    Type '''about:addons'''<enter> in the address bar to open the '''Add-ons Manager.'''
    Hot key; '''<Control>''(Mac:<Command>)'' <Shift> A)'''
    On the left side of the page, select '''Plugins.'''
    Is it listed here? Select '''Disable.'''

  • [svn:fx-trunk] 7661: Change from charset=iso-8859-1" to charset=utf-8" and save file with utf-8 encoding.

    Revision: 7661
    Author:   [email protected]
    Date:     2009-06-08 17:50:12 -0700 (Mon, 08 Jun 2009)
    Log Message:
    Change from charset=iso-8859-1" to charset=utf-8" and save file with utf-8 encoding.
    QA Notes:
    Doc Notes:
    Bugs: SDK-21636
    Reviewers: Corey
    Ticket Links:
        http://bugs.adobe.com/jira/browse/iso-8859
        http://bugs.adobe.com/jira/browse/utf-8
        http://bugs.adobe.com/jira/browse/utf-8
        http://bugs.adobe.com/jira/browse/SDK-21636
    Modified Paths:
        flex/sdk/trunk/templates/swfobject/index.template.html

    same problem here with wl8.1
    have you sold it and if yes, how?
    thanks

  • Base64 encode and image

    Hi there
    I am writing an adobe air app in html/javascript and I am trying to base64 encode an image so I can add it to and XML RPC request. I have tried many methods and nothings seems to work.
    I see that actionscript has a Base64Encoder class that look like it would work, is there any way to utilize this in javascript?
    Thanks,
    Jordan

    Reading it in as an ASCII string loses information - you're much better off reading it in byte-for-byte. Then you can send it as the serializeable of your choice (even a BigInteger would work).

  • Data is not Base64 encoded - error when starting Weblogic connecting to IS

    I get the following error trying to connect to Identity Server from weblogic 7.0 via the weblogic java policy agent from Sun:
    java.lang.ExceptionInInitializerError: java.lang.RuntimeException: Data is not Base64 encoded.
    I have set the encode cookie to true on both the policy agent side and the Identity Server side. I have also restarted both, but still receiving this error.
    Has anyone had similar problems? Any soluitions?

    Hello,
    I am getting the same error for a tomcat policy agent . Ihave installed Identity server on Solaris 9 and Tomcat 4.1.27 on the same machine. I set followinf property in policy agent's AMAgent.properties-
    com.iplanet.am.cookie.encode=true
    However, it doesn't help :-(
    what else is to be done? The documentation says that modify AMConfig.properties file on the client side for this property. Howveer, i do not have AMConfig fil on tomcat side. so i modified AMAgent.property.
    Is that ok?

  • Problem with My Base64 Encoding CLOB  Routine.

    I have written a program which reads an xml file into the database
    and makes it Base64encoded.
    This needs to work on 10g and above
    If the read length specified in the code below is greater than the length of the xml_file, then I get the expected result(output).
    However if the read length is less than the length of the file, then I get a lot of '==' in the file and as a result, incorrect encoding which means that the file will not be readable through the application.
    I'm pretty sure I'm reading the blob lengths correctly, and the problem is somehow related to the base64 encoding.Any help appreciated
    [create or replace profile_dir as &profile_dir;
    create global temporary table load_xml
    (profile_text clob)
    on commit delete rows;
    create or replace
    procedure encode_xml_clobs(p_file_in  in varchar2,
                                 p_clob_out out nocopy clob )
    as
    pragma autonomous_transaction;
        dest_clob   CLOB;
        src_clob    BFILE  := BFILENAME('PROFILE_DIR', p_file_in);
        dst_offset  number := 1 ;
        src_offset  number := 1 ;
        lang_ctx    number := DBMS_LOB.DEFAULT_LANG_CTX;
        warning     number;
    -- processing declarations for encoding base64 --
    v_xml_string varchar2(32767);
    v_string varchar2(32767);
    v_start_pos number := 0;
    v_read_length number := 1000;
    v_final_start_pos number;
    v_clob_length number;
    type clob_array_type is table of clob index by binary_integer;
    clob_array clob_array_type;
    v_index number :=0;
    -- Declarations for converting base64encoded string to a clob
    v_encoded_length number;
    v_temp_clob clob;
    BEGIN
        -- THE FOLLOWING BLOCK OF CODE WILL ATTEMPT TO INSERT / WRITE THE CONTENTS
        -- OF AN XML FILE TO A CLOB COLUMN. IN THIS CASE, WE WILL USE THE NEW
        -- DBMS_LOB.LoadCLOBFromFile() API WHICH *DOES* SUPPORT MULTI-BYTE
        -- CHARACTER SET DATA.
    -- load_xml should be a  Global temporary table with on commit delete rows
        INSERT INTO load_xml(profile_text)
            VALUES( empty_clob())
            RETURNING profile_text INTO dest_clob;
        -- OPENING THE SOURCE BFILE IS MANDATORY
        DBMS_LOB.OPEN(src_clob, DBMS_LOB.LOB_READONLY);
        DBMS_LOB.LoadCLOBFromFile(
              DEST_LOB     => dest_clob
            , SRC_BFILE    => src_clob
            , AMOUNT       => DBMS_LOB.GETLENGTH(src_clob)
            , DEST_OFFSET  => dst_offset
            , SRC_OFFSET   => src_offset
            , BFILE_CSID   => DBMS_LOB.DEFAULT_CSID
            , LANG_CONTEXT => lang_ctx
            , WARNING      => warning
        DBMS_LOB.CLOSE(src_clob);
    --    DBMS_OUTPUT.PUT_LINE('Loaded XML File using DBMS_LOB.LoadCLOBFromFile: (ID=1');
    -- file now successfully loaded
    select dbms_lob.GETLENGTH(profile_text)
    into v_clob_length
    from load_xml;
    -- File now loaded in temporary table
    -- we now need to take the clob , convert it to varchar2
    v_read_length :=64;
    v_xml_string := '';
    while v_start_pos <=  v_clob_length
    loop
    v_index := v_index + 1;
    v_string := '';
    --dbms_output.put_line('Start_pos=>'||(v_start_pos+1)||' Read Length=>'||v_read_length);
    --encode base64
    select utl_raw.cast_to_varchar2(
    utl_encode.base64_encode(
    utl_raw.cast_to_raw(dbms_lob.substr(profile_text,least(v_read_length,v_clob_length-v_start_pos),v_start_pos+1))
      into v_string
      from load_xml;
    --dbms_output.put_line(v_string);
    v_start_pos  := v_start_pos+v_read_length;
    clob_array(v_index) := v_string;
    end loop;
    p_clob_out := clob_array(1);
    for i in 2 .. v_index
    loop
    dbms_lob.append(p_clob_out,clob_array(i));
    end loop;
    commit;
    END;

    Base64 encoding encodes every 3 bytes of input data into 4 bytes of output data. It uses equal signs to indicate nodata and only at the end of the encoded sequence. Try chaning your v_read_length parameter to a multiple of 3 e.g. 960 or 1008 instead of the current 1000. I'm using multiples of 48 because the utl_encode.base64_encode function adds a linebreak for every 48 bytes of input data (64 bytes of output). If you use a value that's not divisible by 48 you will still get a legitimate encoding as long as it's divisible by 3, but you will get some lines longer than others when you append them together.

  • Base64 encoded attachments misunderstood by recipients

    My boss uses Mail.app, and a number of people have reported that they can never open her attachments. When I look at the files they receive from her, they appear to be base64 encoded, and indeed decoding them makes them perfectly readable. Unfortunately, I don't think any of the built-in apps in OS X can do this decoding. Also, not all of the recipients use Macs.
    At first I thought that the issue might be that she was not using the 'Windows friendly attachments'. However, I tried sending a message from another coworker's computer without selecting that option, and it worked fine. I then discovered that the problem is that if she drags her attachments into the message rather than selecting them via 'add attachment', they don't work. Basically, if the attachment is inline rather than at the end of the message.
    I still thought that using 'Windows friendly attachments' would fix the problem, so on another Mac I tried setting Mail.app to always send Windows Friendly attachments (To do this, just open Mail.app, make sure you aren't composing an e-mail, and then under Edit > Attachments, select 'Always send Windows Friendly attachments'). However, this didn't work, either.
    So, I think that the solution is just to tell her either to use the 'Add Attachment' button or to drag the file to the end of the message.
    It's a shame that inline attachments don't work for so many e-mail clients (notably Gmail). I don't think that this is an Apple innovation... is it?
    I hope that helps someone,
    Greg

    Did you ever this to work ?

  • Base64 Encoding in SOA 11.1.1.5.0

    Hi All,
    For writing a String to a Flat File(Opaque Schema) using FileAdapter the string needs to be converted to Base64 Encoding
    I am not able to Encode the string to base64 in BPEL 11g.
    JDEVELOPER VERSION.Studio Edition Version 11.1.1.5.0
    SOA Suite Version 11.1.1.5.0
    I tried with BPEL1.1 specification and BPEL2.0 specification with no luck
    Steps carried out
    a) Created a variable "input1" with String type
    b) Assigned a custom message to input1 variable
    c) In Java Embedding activity wrote the below snippet
    String input = (String)getVariableData("input1");
    addAuditTrailEntry(input);
    String encodeData = oracle.soa.common.util.Base64Encoder.encode(input);
    addAuditTrailEntry(encodeData);
    I am getting different errors while using BPEL 1.1 spec and 2.0 spec
    BPEL 1.1 Spec
    Jdeveloper doesnt compile.
    Error is Error: SCAC-50012
    BPEL 2.0 Spec
    Jdeveloper compile's but while deploying am getting the below error
    Error deploying BPEL suitcase.
    error while attempting to deploy the BPEL component file "/dtrb5o/admin/soa_domain/mserver/soa_domain/servers/soa_server1/dc/soa_04c5e5c5-eeb1-49da-841a-c793206a0285";
    the exception reported is:java.lang.RuntimeException: failed to compile execlets of BPELProcess1
    This error contained an exception thrown by the underlying deployment module.
    Verify the exception trace in the log (with logging level set to debug mode).
    +[05:40:21 PM] Check server log for more details.+
    +[05:40:21 PM] Error deploying archive sca_Base64_2_rev1.0.jar to partition "default" on server soa_server1 [] +
    +[05:40:21 PM] #### Deployment incomplete. ####+
    +[05:40:21 PM] Error deploying archive file:/C:/JdevHome/Users/c_anishi/mywork/BPELApplication/Base64_2/deploy/sca_Base64_2_rev1.0.jar +
    +(oracle.tip.tools.ide.fabric.deploy.common.SOARemoteDeployer)+
    The SOA RunTime Library is already added to the project. I even tried explicitly adding fabric-common.jar and fabric-runtime.jar to the project library with no luck
    Please let me know if any one has acheived the base64 encoding in 11.1.1.5.0

    Check this out,
    http://yatanveersingh.blogspot.com/2011/08/how-to-call-java-method-inside-bpel.html
    -Yatan

  • EEM ::base64::encode unknown to the router...

    An error occurs on an XR device :
    invalid command name "::base64::encode"
        while executing
    "::base64::encode [read $fd]"
    It seems that b64 encoding is not properly declare by default.
    How could I fix that ?

    I don't have access to IOS-XR at the moment with which to test, but I'm not sure the same EEM libraries exist in XR that exist in IOS.  However, there's nothing to keep you from adding them.  At the very least, you can take the tmpsys:/lib/tcl/base64.tcl file from an IOS device, and paste that into your EEM script.  You can also use the EEM user library directory on XR.  Create a directory on the device to hold your library files (e.g. disk0:/lib).  Copy the base64.tcl file to this directory, then configure:
    event manager directory user library disk0:/lib
    Then you can use the ::base64 namespace in your script.

Maybe you are looking for

  • How to add a new field to an newly created tab in QM02?

    HI , I had created a new tab in QM02 using spro. Now I want to add afield (Product hierarchy) to the tab. I have used screen area 090 for it. And have also created a screen (777) in function module XQQM. Can anybody pls elaborate how to add the field

  • IMac...Safari not working when parental controls enabled, even when no safari or application restrictions have been set.

    I woke up one morning to find that Safari could only open webpages on the administrator account. The other accounts had parental controls enabled. However, not all of them even had any restrictions for using applications or Safari content. When I tot

  • Asant build: BUILD FAILED

    Hi All, I'm trying the helloservice example from the J2EE Tutorial. When I build it with asant build, I have the message bellow: generate-wsdl: prepare: [echo] Creating the required directories.... set-wscompile: run-wscompile: [echo] Running wscompi

  • Including other PDF's in cfdocument

    I have been trying to include another NON cfreport PDF to cfdocument and it garbles the the cfinclude. I can create PDF's from coldfusion but cannot combine that with an already PDF in the same directory.. Is it possible to create a pdf and include a

  • Problem visual admin java parameters

    Hi guys, I just wanna know in the visual admin, how to put a new java parameters ? I can't press enter and had a new line ... Can someone had a parameter ? Not a change but a new one ? Thanks.