Best practice - show images on website (wb14)

Startbeitrag von Arie am 10.05.2011 19:35

I have a hfcs database holding photo's. These photo's can be handled by a windev application. Photo's are coming from a smartphone and/or digital camera.
Regular size of a photo is between 1 and 2MB. This is a requirement of my contractor.
I also defined a thumbnail of 160x160, to display the images in a looper control. Works great in a WD app.

Now we want these photo's on a website, of made in WB.
The first site I made is very slow. It holds a listcontrol with addresses. And a looper for the thumbnails.
The looper is linked to a file. When I click an address, I set HFilter for that file. And about 5 photo's are shown in a looper control. But: very very slow.
It looks like the full images are loaded. But when I right-click on the image and save it, it gives me the thumbnail.

Can anyone give me tips?
Please note: I am a webdev beginner.


In the end I also want to click a thumbnail and show a larger photo. Do I need another (bigger) thumbnail for that? I guess the original photo's are overkill for showing in a browser. I'm thinking of adding a download-button for that?

Antworten:

Hi Arie,

Back in WB 12 I implemented a web site with photos like you discuss: see http://www.prodmach.com/ Enter and select Used Search. It actually works quite well and uses a file with basic description and then a linked file with each photo.

The WinDev application that manages the photos has a utility for resizing large images and putting them in a linked file. I use the automatic management of thumbnails in the HF with one thumbnail. The code is below. If you have questions let me know.

HTH,
Jeff


HourGlass(True)
IMG_Web..Visible = True
sTempFile is string = fTempFile("AcAP",fDataDir)
sTempFile = Replace(sTempFile,".tmp",".jpg",IgnoreCase)
IF sTempFile = "" THEN
sTempFile = fDataDir + "Temp.jpg"
Error("Unable to create temp file name in "+ fDataDir, "Using "+sTempFile)
END

PB_EqAvlInfo..Visible = True
PB_EqAvlInfo..MaxValue = HNbRec(EqAvlInfo)

FOR EACH EqAvlInfo
PB_EqAvlInfo += 1
Message("Processing "+EqAvlInfo.ItemNbr)
IF NOT EqAvlInfo.Photo = "" THEN
sMemoInfo is string = HInfoMemo(EqAvlInfo,Photo)
// Retrieve the memo size
sFileSize is string = ExtractString(sMemoInfo, 3, TAB)
IF Val(sFileSize) > 1000000 THEN
IMG_Web..Value = EqAvlInfo.Photo
IF NOT dSaveImageJPEG(IMG_Web,sTempFile, 100) THEN
Error("Unable to save resized image.",EqAvlInfo.ItemNbr,sTempFile)
ELSE
HLinkMemo(EqAvlInfo,Photo,"")
HLinkMemo(EqAvlInfo,Photo,sTempFile,hMemoImg)
HModify(EqAvlInfo)
END
END
ELSE
MultitaskRedraw()
IMG_Web..Value = Null
END
END

fDelete(sTempFile)
sTempFile = Replace(sTempFile,".jpg",".tmp",IgnoreCase)
fDelete(sTempFile)

//OptimizeFiles("EqAvlInfo")

Message("Update complete.")
PB_EqAvlInfo..Visible = False
Wait(500)
IMG_Web..Visible = False
Message("")
HourGlass(False)





von Jeff Graham - am 10.05.2011 22:02
Thanks Jeff,
it's working now.
The imagecontrol and the thumbnail-size (of the field in the hfcs) did not match, so every thumbnail showed the highresolution picture.


von Arie - am 13.05.2011 18:43
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.