× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I had some images on the IBM I server, when transferred to a Windows or Linux machine using FTP/ascii where downloaded properly.

My goal was to embed those images into a XML as part of a Web Service Response, so I 1) streamed those images 2) and base64_encode them as I would regularly would do it with PHP or any other language, but it didn't work. The image was not properly being shown up.

After looking in the several references on the web, I found out that the way to do it is to 1) stream it, 2) convert to ASCII, 3) base64_encode; now I have on the IBM i a REST web service returning a XML with an image on it.

-Jorge





jmerinoh

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Wednesday, April 11, 2012 5:33 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: base64 Encode a tiff image.

On 11-Apr-2012 10:49 , Jorge Merino wrote:

I want to encode a TIF image stored on the IFS and to embed it into an
XML document that will be downloaded on a web browser.

I know that by open() the IFS file, then QDCXLATE(), and
base64_encode() -of course using Scott's tools- do the magic, but has
to be by reading in a loop the buffer returned by open().

However, I want to save some extra programming by avoiding the loop
and convert the full streamed file in one single step (I'm already
using CGIDEV2-LoadStreamFile that returns the streamed file).

I found that I can use 'iconv' API from QTQICONV service program to do
this conversion, does somebody can share an example of parameters to
be used for 'iconv'?.


Perhaps just my ignorance, but where is there a need for dealing with character conversions when the original data is "image"?

Regards, Chuck
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.