setWallpaper base64?

Trying to put a background with an image as Base64.

Doesn't seem to work has anyone got this working? Or know of a reason why it wouldn't?

It only accepts a path of the file, so the code will look for a file called [base64-encoded-image]

Tags: BlackBerry Developers

Similar Questions

  • Error message 'invalid base64 in continuous response data' when you try to access the mail server

    Under Thunderbird 16.0.2 Mac running OS 10.5.8 that worked perfectly for 6 years. Today I suddenly can't connect to the mail server Westnet (Western Australia). Automated or manual sending my password Gets the response "the password sending has failed. "Mail server mail.westnet.com.au replied: data not valid base64 in continuous response.

    I always have access to the web and can access my email via the web portal of Westnet or using the Mail from Mac client. Using Thunderbird but I can not connect.

    This sounds like the server think your already logged in. Try to turn off the machine for 10-15 minutes and have a cup of tea. This should be long enough to force a timeout if there is something hung up at the end of westnet and try again.

  • [PROB] SetWallpaper do not stick...

    I'm with LabWindows CVI 8.0.1 with an application that uses the following line:

    SetWallpaper ("0, «.\\CompanyImage.bmp");

    where "CompanyImage.Bmp" is locate the executable file.  This line works because it sets the background image of Windows XP SP2 to the CompanyImage.bmp, but after restarting the PC and connection on behalf of wallpapers has disappeared (until I run the application again).

    SetWallpaper function call is not designed to apply the wallpaper setting permanently?

    I can't join the code since it is sensitive company.  However, it consists of the Main function that performs the following operations:

    If (InitCVIRTE (0, argv, 0) == 0)
    Returns - 1;  / * memory * /.

    Call LoadPanel for two panels of the IUR.

    SetWallpaper ("0, «.\\CompanyImage.bmp");

    Did other things (setting up the panels, showing their etc.).

    The PC is a Standard Windows XP installation.  There are five users. Two have administrator rights, others are limited accounts.  The problem is observed on the administrator account.

    It isn't really a problem on limited accounts because the software is in the Start Menu Group (i.e. run as soon as the user connects).  The program goes full screen and disables the task bar, so they can't get in to the level of the office.  When they left the program it disconnects them.

    When the software is run on the account administrator or another account with admin rights, my software is not automatically started.  If I do run it and kill it in Task Manager then the wallpaper has the value "CompanyImage.bmp".  If I then sign out and then sign in again the wallpaper was gone.

  • Call Facebook with base64 image + text

    Hello

    I'm trying to share an image (from the extension of the screenshot) to Facebook without saving it to disk. I would also like to be able to include the text and a photo in the invoke call. Unfortunately, while I have an image valid base64 (renders correctly with "window.open" and I can call it to facebook with text only, I'm unable to invoke the image in base64. Pointers would be greatly appreciated!

    function ss() {
    
        var options = {dest:'data:', mime:'image/png'};
        var screenshot = community.screenshot.execute(options);
    
        // check result
        if(screenshot.substr(0,5)=="data:") {
    
            // Pixastic assumes the image is in an img tag
            var oImg=document.createElement("img");
            oImg.setAttribute('src', screenshot);
    
            // crop the image
            Pixastic.process(oImg, "crop", { rect : { left : 0, top : 0, width : 100, height : 100 } }, function (oCanvas){ 
    
                // this works perfectly, so the image is good:
                // window.open(oCanvas.toDataURL()); 
    
                    // this works, so invoke permissions must be right:
                    /*
                    blackberry.invoke.invoke({
                        target: "Facebook",
                        action: "bb.action.SHARE",
                        type: "text/plain",
                        data: "some text"
                    }, function() {console.log("FB SUCCESS!");}, function() {console.log("FB ERROR!");});
                    */
    
                    // no amount of munging with this will work (e.g., using 'data' instead of uri):
                    blackberry.invoke.invoke({
                        target: "Facebook",
                        action: "bb.action.SHARE",
                        type: "image/png",
                        uri: oCanvas.toDataURL()
                    }, function() {console.log("FB SUCCESS!");}, function() {console.log("FB ERROR!");});
                });
        }
    }
    

    I am told that Facebook filters only look at the files.

    If you write in the directory/tmp, it is supported by the RAM, which should alleviate most of the performance issues.

  • Get the string invalid Base64 of image of toDataURL() for the first time in 10 of blackberry webworks

    Hello

    I need to get the Contact image converted to string Base64 using BB 10 Webworks (blackberry.pim.contacts) I get only the contact.photos [0] .smallFilePath which returns the path to the phonebook file.

    Now, I want to get the image of this path and convert it to a Base64 string.

    Here's the javascript code :

    var img = document.createElement ('Image');
    var canvas = document.createElement ('Canvas');

    function getBase64Image (p) {}
    img.setAttribute ("src", p);

    Img.width = Canvas.Width;

    Canvas.height = img.height;

    CTX var = canvas.getContext ("2d");
    ctx.drawImage (img, 0, 0);
    Return canvas.toDataURL("image/jpg");

    }

    This means bad Base64 string of image for the first time. When I convert this string to the image it displays white screen. But returns a string in the Mithraeum and after conversion, display a correct image.

    I use Blackberry Z10 (OS 10) for the test.

    I think that the canvas is not drawing image properly for the first time.

    I have searched and tried many things, but not got success. What will be the solution.

    Thanks in advance.

    My guess is that the image did not load the source completely still. Setting the src / image loading is an asynchronous event, which means that your code will continue to the next line regardless of whether the image has loaded yet or not.

    After calling setAttribute instead of execute the code of the Web, you will probably need define an event on img for the load event listener. Once the image is loaded, you can then use the img with canvas variable to retrieve its data.

    Note that getBase64 will return immediately, so you may need to develop some sort of mechanism to wait before returning, or the asynchronous approach and integrate reminders for the success trigger the next piece of code.

  • [Email] Savings in base64 accessories for use in EML

    I try to save e-mails to eml files. For attachments, how can I get the binaries base64 encoding?

    I guess I could make a Qdatastream, but wouldn't the encoding Base64 requires reading across the folder at a time?

    The bindings can be from a few kb (quick question) to 50 + mbs, can someone point me in the right direction

    I think that Base64 encoding works on groups of 3 bytes at a time, so you would not need to read any attachment in a go. QByteArray has a method toBase64(), that you can use for this.

    See http://www.ietf.org/rfc/rfc2045.txt where it says:

     The encoding process represents 24-bit groups of input bits as output
       strings of 4 encoded characters.  Proceeding from left to right, a
       24-bit input group is formed by concatenating 3 8bit input groups.
       These 24 bits are then treated as 4 concatenated 6-bit groups, each
       of which is translated into a single digit in the base64 alphabet.
    
  • The default value of block SystemToast after setWallpaper

    Hello

    Every time I call bb/platform/HomeScreen.setWallpaper via QML and the call succeeds, a default value for SystemToast is shown with the text "photo set as wallpaper." It's pretty much the same that appears when you change the wallpaper via the settings > display.

    When I show a SystemToast with a different message right after calling setWallpaper, two notifications appear both on the other. If you see carefully the attached screen you can see my custom behind the default notification message.

    How can I stop this from happening?

    OS version 10.2.1.1055, using the SDK 10.2.1 gold.

    See you soon.

    I'm not sure that you would be able to prevent the system, but you can postpone your one or change its position...

    http://developer.BlackBerry.com/native/reference/Cascades/bb__system__systemtoast.html#property-posi...

  • Base64 encode and decode

    Hello

    I use opennssl for encoding and decoding base 64 and face to face some of the question, he refuses to randomly to encode or decode, to give me a result of 0 and not false BIO_SHOULD_RETRY... I'm trying to put the call in a while if return 0, but it does not work and so I can not decode or encode more...

    The code I am using:

    uint8_t* Tools::base64(uint8_t *input,  uint32_t length)
    {
            BIO *bmem, *b64;
            BUF_MEM *bptr;
    
            b64 = BIO_new(BIO_f_base64());
            BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
            bmem = BIO_new(BIO_s_mem());
            b64 = BIO_push(b64, bmem);
    
            // write data
        bool done = false;
        int res = 0;
        while(!done)
        {
            res = BIO_write(b64, input, length);
    
            if(res <= 0) // if failed
            {
                if(BIO_should_retry(b64)){
                    continue;
                }
                else // encoding failed
                {
    
                    qDebug("error while encoding base64");
                    done=true;
                }
            }
            else // success!
                done = true;
        }
    
         //   BIO_write(b64, input, length);
            BIO_flush(b64);
            BIO_get_mem_ptr(b64, &bptr);
    
            uint8_t *buff = (uint8_t *)malloc((bptr->length)+1);
            memcpy(buff, bptr->data, bptr->length);
            buff[bptr->length] = 0;
    
            BIO_free_all(b64);
    
            return buff;
    }
    
    uint32_t Tools::decode64(uint8_t *pInput, uint32_t inputLen, uint8_t ** ppOutput)
    {
            BIO *b64, *bmem;
            uint32_t readLen;
    
            (*ppOutput) = (uint8_t *)malloc(inputLen);
            memset((*ppOutput), 0, inputLen);
    
            b64 = BIO_new(BIO_f_base64());
            BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
            bmem = BIO_new_mem_buf(pInput, inputLen);
            bmem = BIO_push(b64, bmem);
    
            // write data
        bool done = false;
    
        while(!done)
        {
              readLen = BIO_read(bmem, (*ppOutput), inputLen);
    
            if(readLen <= 0) // if failed
            {
                if(BIO_should_retry(b64)){
                    continue;
                }
                else // encoding failed
                {
    
                    qDebug("error while decoding base64");
                    /*int reason;
                    BIO_get_retry_BIO(b64,&reason);
                    qDebug() << "reason of bio bug " << reason;*/
    
                    //dont know what to do ;-(
                    done=true;
                }
            }
            else // success!
                done = true;
        }
    
            BIO_free_all(bmem);
    
            return readLen;
    }
    

    If you have ideas do not hesitate to discuss it!

    Thanks in advance!

    Try http://qt-project.org/doc/qt-4.8/qbytearray.html#toBase64

  • The Base64 URL encoding issue

    Hello

    I have a small question...

    is there an API or something that could encode a URL base64 for me?  If yes where can I find more information on this?

    Thank you very much

    http://www.BlackBerry.com/developers/docs/6.0.0api/index.html

    http://www.BlackBerry.com/developers/docs/6.0.0api/NET/rim/device/API/IO/Base64InputStream.html

  • Error! : duplicate definition for 'org.kobjects.base64.Base64', in: org.kobjects.base64.Base64

    Hi, using ksoap 2 jar, I get following error. Someone can he figure out?

    "Error!: duplicate definition for 'org.kobjects.base64.Base64', in: org.kobjects.base64.Base64 '...

    Maybe you added two libraries with this class? for example ksoap2 and kxml?

  • Troubé with Base64 and qCompress/qUncompress

    I need to compress and coded a QString in base 64. I wrote 2 methods for this task. These methods are:

    /*
    * Compress a QString and converts to Base 64
    */
    QString BlackBerry10Utils::compressAndBase64(const QString ¶mString)
    {
        QByteArray byteArray;
        byteArray.append(paramString);
    
        byteArray = qCompress(byteArray);
        byteArray.toBase64();
        byteArray.remove(0, 4);
    
        QString result = QString(byteArray);
    
        return result;
    }
    
    /**
     * Converts from Base 64 and un-compress a QString
     */
    QString BlackBerry10Utils::base64AndUnCompress(const QString ¶mString)
    {
        QByteArray byteArray;
        byteArray.append(paramString);
    
        byteArray = QByteArray::fromBase64(byteArray);
        byteArray = qUncompress(byteArray);
    
        QString result = QString(byteArray);
    
        return result;
    
    }
    

    And my test code:

    QString str ("Hello, World!");
    Str = BlackBerry10Utils::compressAndBase64 (str);

    Str = BlackBerry10Utils::base64AndUnCompress (str);

    However, the process does not return a str than its original value.

    I used the same method in Android, Java, BlackBerry, WindowsPhone, and works very well...

    There is a line in base64AndUnCompress:

    QString result = QString(byteArray);
    

    It is the equivalent of the call to QString::fromAscii() which does not work properly for most of encodings.

    Try to replace it with:

    QString result = QString::fromUtf8(byteArray.data(), byteArray.size());
    

    To do the same thing according to compress too much, but it is not important for base64-encoded data, it does not use the 8th bit.

    In compressAndBase64, replace

       QByteArray byteArray;
        byteArray.append(paramString);
    

    with

    QByteArray byteArray(paramString.toUtf8());
    
  • Is there a quicker way to convert Base64 String Bitmap in OS 4.5 than what I am currently using?

    I use this method to convert strings in Base64 to Bitmap.
    It works fine, except that it takes too long to convert the images.

    The time increases depending on the size in bytes of the image, as expected.

    But I've used a few apps before BB on my 8300 appliance.
    and the Base64 images are converted more rapidly than in my application.

    Is there a faster way to achieve what I need or a way to improve
    This code?

    public convertBase64ToBitmap (String, Byte) {Bitmap image
    ByteArrayInputStream bis = new ByteArrayInputStream (pImage.getBytes (), 0, pImage.getBytes () .length);
    B64 Base64InputStream = new Base64InputStream (bis);
    ByteArrayOutputStream Bos = new ByteArrayOutputStream();
    buff Byte [] = new byte [1024];
    {for (int len = b64.read (buff); len! = - 1; len = {b64.read (buff))}
    Bos.Write (buff, 0, len);
    }
    Byte [] decoded = bos.toByteArray ();
    String dd = new String (decoded);
    Byte [] dataArray = dd.getBytes ();
    EncodedImage encodedImage = EncodedImage.createEncodedImage (dataArray, 0, dataArray.length);
    Bitmap bmp = encodedImage.getBitmap ();
    return bmp;
    }

    Thanks in advance!

    I just thought of this.  I would like to use a direct conversion, but if you want to stick with Base64InputStream

    So what follows is probably more effective.

    Byte [] inputBytes by performing a = pImage.getBytes () / / only for this operation once...

    ByteArrayInputStream bis = new ByteArrayInputStream (inputBytes by doing one, 0, inputBytes.length);

    B64 Base64InputStream = new Base64InputStream (bis);

    Byte [] dataArray = IOUtilities.streamToBytes (b64);

    EncodedImage encodedImage = EncodedImage.createEncodedImage (dataArray, 0, dataArray.length);
    Bitmap bmp = encodedImage.getBitmap ();
    return bmp;

    Don't forget that you can use the Profiler to check performance.

  • Convert binary (Blob) image file to string base64 on PlayBook?

    I need to download image files of the PlayBook to a Web server.

    When you use BB10, it's pretty easy, basically just using reader.readAsBinaryString (file) to get the file as a string, encode in Base64, then send it with xml.send(fileData). Which works very well with my Z10.

    But the PlayBook seems to have its own file system that does not work the same as handling BB10. I can read the file very well with blackberry.io.file.readFile (path, pbOpenImageFile)image, but it gives me just the Blob. How can I get this Blob converted a Base64 string for sending with xml.send (fileData)?

    blackberry.utils.blobToString (blobData) doesn't seem to work, at least not with my image data (works very well with my text files however). He also apparently has a size limit that could be a problem with the images anyway.

    Is it possible to get that converted to a string in Base64 Blob?

    I have it.

    Take the idea of here something like:

    var can = document.getElementById ('canvas');
    var can.getContext ('2d') = CTX;
    var img = document.getElementById ('tweetpic');
    ctx.drawImage (img, 0, 0);
    var b64Text = can.toDataURL ();
    b64Text = b64Text.replace ("data : image/png;") Base64,', ");
    var fileData = b64Text;

    And then xml.send (fileData); as usual

  • How to encode the string in base64 format

    Hello

    I need to encode variable QString in base64 format.   I am new to this technology. Could someone please tell me how should I do this?

    https://developer.BlackBerry.com/native/reference/Cascades/QString.html#toUtf8 returns a QByteArray

    or https://developer.blackberry.com/native/reference/cascades/qbytearray.html#append-2 adds a QString to a QByteArray

  • Download Base64?

    I have an image in the format base64 as variable in the Cascades.

    How can I download it as a png to the file system?

    You can refer to this link...

    http://StackOverflow.com/questions/6912456/how-do-i-save-base64-string-as-PNG-image-in-Qt

Maybe you are looking for