Re: Display BYTE in HTML generated by 4gl cgi
Posted in 1999
Topics: Stored Procedures & SPL, Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL, Migration, Import/Export & Data Conversion
I'll reply to my own question.
IT DOES WORK. Apparently, DELPHI stores the image file differently than does 4GL.
If I use the same LOCATE process to INSERT/UPDATE the byte, the SELECT then works.
(This is actually what I wanted originally, update the image from the web, then display to the web at a later time)
Final code snippets to support BYTE update / select in 4gl, for those interested ...
define pic byte
define file_name char(256)
# UPDATE THE PHOTO logic
let file_name = "/wwwroot/original_images/", VARIABLE, ".jpg"
locate pic in file file_name
update images set picture = pic where user_id = VARIABLE
if sqlca.sqlcode = 0 then
.......
# SELECT and DISPLAY the PHOTO logic
let file_name = "/wwwroot/tmp_images/", VARIABLE, ".jpg"
locate pic in file file_name
initialize pic to NULL
select picture into pic from images where user_id = VARIABLE
if sqlca.sqlcode = 0 then
display '<img src="http://www.my_intranet/tmp_images/';, VARIABLE CLIPPED, '.jpg"
alt="', VARIABLE, '" width="110" height="110" border="0">'
else
display 'Image unavailable'
end if
Many thanks to ddubovoy.
==========
Sky Southwell
Maricopa County Attorney's Office
Phoenix, AZ 85003
southwel@mcao.maricopa.gov
==========
>>> "Sky Southwell" <southwel@mcao.maricopa.gov> 09/10/99 08:12AM >>>
Thanks for the suggestion.
Closer, but still not quite right (and since this isn't a horseshoe or hand grenade :-) )
An original image is 12295 bytes.
UNLOAD gives a HEX dump file of 457270 bytes.
Using the suggested LOCATE code, the file is 228634 bytes, and contains values such as
p5q5q5q5q5q5q5Q5P5p5p5p5p5p5p5p5P1p1q5q1p1p1p5p9p5O5P5p9p9p9O5p5p5p5p5p5p5p5p5p5
which looks nothing like the strings within the original binary image file. The fact I save this with DELPHI shouldn't matter, should it? Should I save it from the 4GL program?
I hate to say it, but I may be forced to investigate the ESQL/C option suggested in an earlier reply, although we do not currently use the product. Or migrate the app from 4GL to ... a VB or DELPHI DLL, ... I really don't want to put up an IIS/NT server just for this.
Thanks to all who replied.
==========
Sky Southwell
Maricopa County Attorney's Office
Phoenix, AZ 85003
southwel@mcao.maricopa.gov
==========
>>> <ddubovoy@yahoo.com> 09/09/99 06:52PM >>>
In article <7r3ocf$5f$1@nnrp1.deja.com>,
southwel@my-deja.com wrote:
> I've written a cgi program (INFORMIX-4GL Version
> 6.00.UE3) that works very well at querying and
> displaying data from an IDS database to an HTML
> page. Problem: I now have a need to display a
> BYTE value (JPG). I realize the IMG tag needs a
> URI, so I am attempting to save the BYTE to a temp
> file, then display that. UNLOAD give a HEX dump
> that is of no use, and REPORT simply writes 'BYTE
> value' into the file, also of no use.
Try to use LOCATE statement with named file for you byte variable.
It should be something like this:
define pic byte
define file_name char(256)
define cmd char(256)
let file_name = "/wwwroot/images/1.gif"
locate pic in file file_name
initialize pic to NULL
select picture into pic from images where image_name = "1.gif"
--
ddv
>
> I know the byte value is O.K., as I am able to use
> DELPHI to store and retrieve the value.
>
> Aside from buying the Universal server options, is
> there a way to display a BYTE in a browser? Has
> anyone done this?
>
> =====
> Sky Southwell
> Data Management
> Maricopa County Attorney's Office
> Phoenix, AZ 85003
> southwel@mcao.maricopa.gov
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.