Solved

Picture Diplays

Posted on 2002-07-23
6
570 Views
Last Modified: 2013-12-26
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
/////////////////////////////////////////////////////////
0
Comment
Question by:valiant_at_mci
6 Comments
 

Author Comment

by:valiant_at_mci
ID: 7174164
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
 
LVL 4

Accepted Solution

by:
Bhatti earned 100 total points
ID: 7176632
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
 

Expert Comment

by:theodude
ID: 7268091
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Expert Comment

by:AFI
ID: 7462397
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
 
LVL 2

Expert Comment

by:AFI
ID: 7462416
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
 

Expert Comment

by:SpideyMod
ID: 8297115
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Remove unused usings from code in MonoDevelop 8 433
error when i compile 5 569
Eclipse for PHP 1 95
Notepad++ Remote File Management 3 79
In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now