Decoding base64 data and extracting images

Discussion in 'ASP General' started by gRizwan, Sep 20, 2005.

  1. gRizwan

    McKirahan Guest

    Nope.

    There's not enough encoded data to represent an image.

    Below is the encoded data for a 43 byte GIF image:

    R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==
     
    McKirahan, Sep 21, 2005
    #21
    1. Advertisements

  2. gRizwan

    Evertjan. Guest

    wrote on 21 sep 2005 in microsoft.public.inetserver.asp.general:
    Use the javascript
    base64Decode(str)
    [and base64Encode(str)]
    functions from
    <http://www.hw-group.com/support/tea/index_en.html#BASE64>

    Yes, these javescript functions can be used in ASP
     
    Evertjan., Sep 21, 2005
    #22
    1. Advertisements

  3. gRizwan

    gRizwan Guest

    Thanks for your reply Evertjan, do u think above decoded data is
    incorrect? so that we go for some other decoding algo.

    If No, then how to extract images from that decoded data?
     
    gRizwan, Sep 21, 2005
    #23
  4. gRizwan

    Evertjan. Guest

    wrote on 21 sep 2005 in microsoft.public.inetserver.asp.general:
    Above?

    On usenet please always quote, this is not email.

    If with Google groups this is difficult, please use a real News-reader.
    Most are free.
     
    Evertjan., Sep 21, 2005
    #24
  5. gRizwan

    gRizwan Guest

    Sorry Evertjan didn't realise that :(
    You can see encoded data in a XML file's MMS tag at
    http://www.pakitfriends.com/mms.xml
    Here is the decoded data by a base64 decoding algorithm from encoded
    data.
    We need to extract image attachments from this message.
    How can we do that?

    ********** Decoded Data ***********
    MIME-Version: 1.0
    Subject:
    From: +447796170669
    To: +447719336699
    Mxtelecom-Id: 15881964
    Date: 2004-06-18 21:28:13
    Content-Transfer-Encoding: binary
    Content-Type: multipart/related;
    boundary="F3X/kupo3+S3vrIYnnksMQAAAAM="; start="<mms.smil>";
    type="application/smil"


    --F3X/kupo3+S3vrIYnnksMQAAAAM=
    Content-Type: application/smil; name=mms.smil
    Content-Id: <mms.smil>
    Content-Transfer-Encoding: 7bit


    <smil>
    <body>
    <par dur="5s">
    <ref src="t0" />
    </par>
    <par dur="5s">
    <text src="t1%3At1.txt" />
    </par>
    <par dur="5s">
    <img src="i1%3ATeifi.jpg" />
    </par>
    </body>
    </smil>


    --F3X/kupo3+S3vrIYnnksMQAAAAM=
    Content-Type: application/smil; name=t0
    Content-Transfer-Encoding: binary
    Content-Id: <t0>


    <smil>
    <head>
    <layout>
    <root-layout height="127" width="111"/>
    <region id="Image" top="50%" left="0%" height="50%" width="100%"/>
    <region id="Text" top="0%" left="0%" height="50%" width="100%"/>
    </layout>
    </head>
    <body>
    <par dur="60000ms">
    <text src="cid:t1:t1.txt" region="Text"/>
    <img src="cid:i1:Teifi.jpg" region="Image"/>
    </par>
    </body>
    </smil>


    --F3X/kupo3+S3vrIYnnksMQAAAAM=
    Content-Type: text/plain; name=t1%3At1.txt
    Content-Location: t1%3At1.txt


    Apicheck
    --F3X/kupo3+S3vrIYnnksMQAAAAM=
    Content-Type: image/jpeg; name=i1%3ATeifi.jpg
    Content-Transfer-Encoding: binary
    Content-Location: i1%3ATeifi.jpg


    ÿØÿáExif
    *****************************
     
    gRizwan, Sep 22, 2005
    #25
  6. gRizwan

    Evertjan. Guest

    wrote on 22 sep 2005 in microsoft.public.inetserver.asp.general:
    [ again: please quote,
    there are more readers than me alone on usenet,
    otherwise it would be email,
    netiquette is important on usenet ]
    The mms line can be easily decoded by:

    document.write(base64Decode(str).replace(/</g,'&lt;'));

    [see the link I gave for the content of the base64Decode() function]

    You cannot, they are not there.

    Perhaps in seperate files or seperate mail?

    These seems to be a strange mixup in wording of protocol:

    - attachments are not attached.

    - attachted attachments are called enclosures.
     
    Evertjan., Sep 22, 2005
    #26
  7. gRizwan

    gRizwan Guest

    The mms line can be easily decoded by:
    Evertjan. this is just a sample i am given, there might be few more
    available once we develop the code, but suppose attachements are there,
    how can we extrat (specially attached images) those in ASP?
     
    gRizwan, Sep 22, 2005
    #27
  8. gRizwan

    Evertjan. Guest

    wrote on 22 sep 2005 in microsoft.public.inetserver.asp.general:

    If you have the total email string as the value of a variable in ASP,
    you will have to select the base64coded part by old Basic functions
    [left, mid, right] or regular expressions if you want to code in VBscript,
    or if you code in Jscript in the similar functions, like .substr() or
    substring(), or also regex. [If you cannot do that, I suggest you hire a
    professional or learn more VBS and/or JS]

    and then use

    decodedString = base64decode(codedString)
     
    Evertjan., Sep 22, 2005
    #28
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.