Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    2

    Problem - Decode and save image jpeg on the server received from J2ME

    Eng language
    IN J2ME i send form server image

    byte[] raw = videoControl.getSnapshot("encoding=jpeg");
    String postVar = "data=" + new String(Base64.encode(raw, 0, raw.length));

    IN PHP i get image


    $text = base64_decode($_POST['data']);
    file_put_contents("original_filename.jpeg", $text);


    and when you open the picture, it will not boot.

    Ru language - На русском

    В J2ME я отправляю на сервер картинку

    byte[] raw = videoControl.getSnapshot("encoding=jpeg");
    String postVar = "data=" + new String(Base64.encode(raw, 0, raw.length));

    В PHP я получаю картинку

    $text = base64_decode($_POST['data']);
    file_put_contents("original_filename.jpeg", $text);


    и при открытии картинки, она не загружается.




    ВОПРОС ANSWER WHAT A FUCK!?!?
    Last edited by wellnemo; 2012-04-01 at 01:38.

  2. #2
    Registered User
    Join Date
    Apr 2012
    Posts
    2

    Re: Problem - Decode and save image jpeg on the server received from J2ME

    я разобрался.
    <?php
    $myFile = "javatest.txt";
    $fh = fopen($myFile, 'wb') or die("can't open file");

    $text = $_POST['data'];



    $text = stripLineBreaks($text);

    fwrite($fh, $text);
    fclose($fh);

    function stripLineBreaks( $encode )
    {
    $data= str_replace( ' ', '+', $encode );
    return $data;
    }


    // ваш j2me говнокодерский, не передовл плюсики

    $text = base64_decode($text);

    file_put_contents("original_filename.jpeg", $text);

Similar Threads

  1. Encode and Decode image from server to device
    By akmmaurya in forum Mobile Java General
    Replies: 8
    Last Post: 2010-09-15, 11:22
  2. Upload jpeg image to server.
    By jithesh@axxonet.com in forum Mobile Java General
    Replies: 2
    Last Post: 2010-08-30, 07:50
  3. jsr172 problem: can't decode the received response package
    By jason_rency in forum Mobile Java General
    Replies: 11
    Last Post: 2006-08-10, 15:49
  4. URGENT: how to save Image to JPEG Format?
    By rj_cybersilver in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2005-06-03, 12:13
  5. URGENT: how to save Image to JPEG Format?
    By rj_cybersilver in forum Mobile Java General
    Replies: 0
    Last Post: 2005-05-31, 11:04

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×