Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 7 Jahren, 4 Monaten
Letzter Beitrag:
vor 7 Jahren, 4 Monaten
Beteiligte Autoren:
Piet van Zanten, Joel

WebDev 15 - need to get picture to app

Startbeitrag von Joel am 17.03.2011 18:11

Hi all -

I have a basic contacts dbase and want to get a picture into a contact record - the simplest thing seems to be, take a pic with a camera, connect camera to pc via usb, upload picture and assin it to a particular contact - pretty easy

But - what about needing the picture to be not bigger than a particular size - MB and pixels? If there an easy way to build an interface so the user can alter the picture from the camera before uploading it - they might even need to crop & reposition the picture.

Anyone ever do this?

Antworten:

Hi Joel,

This is quite simple, you create an image control off screen, anchor top right, display mode homothetic. It is called img_Resize.
Then you execute code to load the image into the image control, after setting the desired size to the image control. Then you store the image into the database. In this case the new height is found in the edit control edt_Image_Height. The image is resized homothetically.
x,sFile,sFotoExt are string
nWidth,nHeight is int

sPhotoExt="jpg"
sFile = fSelect("", "", "Choose a photo to import", "All files (*.*)" + TAB + "*.*" + CR + sPhotoExt + TAB + "*."+sPhotoExt + CR + fGraphicFilter(), "*."+sPhotoExt, fselOpen + fselExist)

IF sFile="" THEN RETURN
HourGlass()
x=BitmapInfo(sFile)
nWidth=ExtractString(x,2)
nHeight=ExtractString(x,3)
IF nHeight>0 AND nWidth>0 THEN
img_Resize..Height=edt_Image_Height
img_Resize..Width=edt_Image_Height/nHeight*nWidth
img_Resize=sFile
//get the persons number
edt_Number=iw_InternalWindow1.col_PersNr
//photo into buffer
ScreenToFile("",Pe_photo)
//insert or replace the photo
IF HSeekFirst(Pe_photo,PersNr,edt_Number) THEN
HModify(Pe_photo)
ELSE
HAdd(Pe_photo)
END
HErrorDuplicates()
//clMyPhoto is a class that displays the photo in another control on the window
clMyPhoto:ShowPhoto(PE.PersNr)
END
HourGlass(False)
Best regards,
Piet





von Piet van Zanten - am 17.03.2011 22:41
Forgot to mention that the image control is linked to the file-item.


von Piet van Zanten - am 18.03.2011 11:03
Hi Piet -

Thanks! I'll give this a try -

a few questions - this looks like it was done in WinDev, I use WebDev, I assume the basic concept will still work?

Hourglass() - can't find this function in the WB help - is that something you came up with? I'm looking for a way to change the "System" busy icon to one of the ones in the animated image library.

As I get deeper into this, I'll probably have questions - do you mind if I pass them along to you if them come up? - (promise I won't bug you!)

I'm also looking for developers to help me with my project - is that anything you might be interested in - or do you have any recommendations in that area?



von Joel - am 18.03.2011 12:42
Hi Joel,

Sorry, I missed the Webdev 15 in your subject.
Indeed, this is a very Windev specific approach, so I have a strong feeling that this will not work in Webdev. Sorry.

Best regards,
Piet


von Piet van Zanten - am 18.03.2011 14:28
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.