Picture Diplays

2 part question:

1. Has anyone ever been able to display a JPG in a picture field?  I am currently selecting a BLOB from the database, writing it to a file locally, then dynamically setting a picture in a window on the application.  It will not show up as a JPG, but I can get BMPs to be displayed.  Is there a function to convert?  Or is there a function that can handle displaying JPG format?

2. How do I get around the 32k limitation on pictures?  I have employee pictures that need to be displayed and are in the database as JPGs atm, but larger than 32k.  In searching my temporary directory after FileRead() and FileWrite() functions, the JPG is placed in the directory, but only about the top 5th of the picture is displayed.

Thanks much in advance
(Code for my OPEN event on a window with a picture box appears below)
/////////////////////////////////////////////////////////
blob temp_pic
int li_FileNum
long ll_FLength

SELECTBLOB picture
INTO :temp_pic
FROM card
WHERE card_id = '001983703'
USING SQLCA;
li_FileNum = FileOpen( "C:\TEMP\IDCARD.JPG")

FileWrite(li_FileNum, temp_pic)

IF li_filenum <> -1 THEN
     ll_FLength = FileLength("C:\TEMP\IDCARD.JPG")
     FileRead(li_filenum, temp_pic)
     FileClose(li_filenum)
     p_1.SetPicture(temp_pic)
END IF
/////////////////////////////////////////////////////////
valiant_at_mciAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
BhattiConnect With a Mentor Commented:
If you are using PB 6.x then you can work only with BMP, MWF files. In PB 8.x you can work with JPG files.

Converting to BMP: There are many programs which convert the bmp files to JPG. I think you need then Licence. Most firms have already such programms as "Paint shop pro", Some programms are included when you buy a "scaner" or "printer".

Please read more information about "paint shop pro" in internet you may find some small or basic product for converting.

You are writing a file in the temp_pic.

I wrote you before:

Use the computered field. and function inside the computed field (Bitmap()). Save the ID-Nr. in the table.
Get this id-Nr and pick the BMP or JPG from the current directory.

When there will be a new user then just enter the new ID-Nr for the new user and BMP or JPG file in the current directory. (IN THIS CASE USE THE BitMap(string_as_filename) IN YOU SCRIPT). In the clicked event of the button from where you are calling the user information.


I did it before and know how it work and still working good.

If you have any difficuty please let me know where.

THANKS

Best regards


Bhatti
0
 
valiant_at_mciAuthor Commented:
Have been able to take the pictures from the table and FileRead() in 32k chunks and store to temporary BLOBs then Concantenate the Blobs and Viola!  There's my picture.

In JPG format.  Does anyone even have a small exe that I can house locally that can be called from PB for conversion to BMP?  (Preferable JPG in BMP out, and JPG in and BMP out).

0
 
theodudeCommented:
Per prev comments - PB6 didn't natively support JPEG or GIF's.  You had to buy a 3rd party product like http://www.pegasusimaging.com/imagn.htm 

In PB7 and PB8 a picture can be a JPEG or GIF too. However, in PB7 embedded JPEG or GIF objects in a datawindow would not print correctly - I was just getting black squares.

It ended up that as I selected the JPEG blobs out of the database and wrote them to a file, I used a freeware JPEG->BMP command line tool (jpgtobmp.exe using pb run command) to convert each picture to a bmp. Then I set my dw picture source reference column to the fully qualifed name of the bmp for that row. This was a pain but allowed me to store smaller JPEG in DB but still print multipicture dw.

Havn't tested the dw picture problem in PB8 yet - hopefully Sybase fixed it.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
AFICommented:
Hello. I use a Visual External UO to display .jpg into PB directly from a file path...

In the DLL Name section write comctl32.dll and in the Class Name syslistview32.

//Constructor Script
Long ll_null

SetNull(ll_null)
OleInitialize(ll_null)

//Destructor Script
OleUninitialize()

//Local External Declaration
Function integer ListView_SetBkImage(long hWnd, long uMsg, long wParam, REF LVBKIMAGE image) library "user32.dll" Alias For "SendMessageA"
Function long  OleInitialize(long pvReserved) LIBRARY "ole32.dll"
SUBROUTINE OleUninitialize() LIBRARY "ole32.dll"

//Declare a UO function
/*------------------------------------------------------------------------------
 Object:     lv_imageviewer
 Function:       of_Set_image
 Parameters:      string as_imagepath
 Returns:         integer

 Copyright © 2000 SOFTRAX - Philip Salgannik
 Date Created: 05/24/00

 Description:          

--------------------------------------------------------------------------------
 Modifications:
 Date            Author              Comments


------------------------------------------------------------------------------*/
IF IsNull(as_imagepath) OR Trim(as_imagepath) = "" THEN RETURN FALSE
IF NOT FileExists(as_imagepath) THEN RETURN FALSE

LVBKIMAGE lstr_LVBKIMAGE
lstr_LVBKIMAGE.pszImage = as_imagepath
lstr_LVBKIMAGE.ulFlags = LVBKIF_STYLE_NORMAL + LVBKIF_SOURCE_URL

integer li_rtn
li_rtn = ListView_SetBkImage(handle(this), LVM_SETBKIMAGE, 0, lstr_LVBKIMAGE)

RETURN li_rtn <> 0
0
 
AFICommented:
Sorry, this can be use in PB6.5

I forgot send you de UO structure.

lvbkimage //structure name.
ulflags         unsignedlong
hbm             unsignedlong
pszimage        string
cchimagemax     unsignedinteger
xoffsetpercent  integer
yoffsetpercent  integer
0
 
SpideyModCommented:
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.