[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Looking for best option



Scott,

A co-worker pointed out that I should convert the base64_decode result back
to ascii before writing it out to the file.  I added a rc =
http_xlate(%len(%trimr(val2)): val2: TO_ASCII); statement after the
base64_decode call.  It is still not right but the stream file size matches
the good one now. 

Thanks,
Bruce

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Bruce Reynolds
Sent: Tuesday, January 06, 2009 2:17 PM
To: 'HTTPAPI and FTPAPI Projects'
Subject: RE: Looking for best option

Hi Scott,

Attached is the source from a test program that makes the image request and
decodes it using base64_decode.  I've also attached a savf containing the
output of the same image from Tomkat.  Could you take a look and see what I
am doing wrong as they are not the same.

The reason I can view tiff images in my browser is because of the
Alternatiff plugin. 

Thanks,
Bruce

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Monday, January 05, 2009 3:19 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Looking for best option

Bruce Reynolds wrote:
> 
> From previous email postings I understand that base64 data should not 
> be converted to EBCDIC

Why not?  base64_decode() (from BASE64R4) won't understand the data unless
it's EBCDIC, so I don't understand why you'd say this.

The whole point behind base64 is that you can translate the encoded data any
way you like.  That's the POINT of base64.  Feel free to translate the
encoded data to EBCDIC -- it's the DECODED data that you have to be careful
with.

Therefore I'd do this:

a) Call http_XmlReturnPtr(*ON)
b) Call http_url_post_xml().
c) in your end element handler, check for the BASE64DATA tag.
d) if BASE64DATA, allocate temporary memory for the output from
base64_decode().
e) if BASE64DATA, call base64_decode()
f) if BASE64DATA, open an IFS file.
e) if BASE64DATA, write decoded data to IFS.
f) if BASE64DATA, close file.
g) if BASE64DATA, deallocate temporary memory.

The result should be your TIFF file.

The other flaw in your logic is that browsers don't usually understand TIFF
files.  You may need to convert them to PNG or JPG first, then send THAT to
a browser.  If that turns out to be an issue, you might look into
imagemagick to see if it can convert your TIFF to another format.

Make sense?  Let me know if you need more info on any of these steps.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------