Solved

Picture Diplays

Posted on 2002-07-23
6
571 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WordPress Editor tool bar I have doesn't match what is in product documentation. 14 70
HTML-Kit Question 5 99
Custom ckeditor using builder 10 100
Angular JS Route 3 71
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
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 and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

809 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