Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Picture Diplays

Posted on 2002-07-23
6
Medium Priority
?
579 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 400 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
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.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

670 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