View Full Version : cWPWebColumnImage won't work with images per line

18-Aug-2017, 08:48 AM
Defining images for a cWPWebColumnImage doesn't seem to work, when defining the images on a record by record basis.
They work fine if we call the WebApp itself, but they won't show up if the WebApp is embeddet into WordPress.

A good example for that is http://www.dataflex4wordpress.com/index.php/en/weborder-mobile/
The poor sales persons are all faceless monsters ;) (click on "Sales Person Query")

Mike Peat
18-Aug-2017, 09:35 AM

Which DF version are you using?


18-Aug-2017, 09:37 AM
We are using DF19

Mike Peat
18-Aug-2017, 12:25 PM
Understood - there are issues with DF19 and DF4WP. We will be preparing a new version of the plugin shortly to resolve these.

Re "faceless monsters" - I too saw those at first, but a hard page reload turned them into to beautiful people I was hoping for... some browser caching issue I expect. (Or maybe they really are all faceless monsters and we caught them by surprise before they had time to assume their reassuringly human disguises! :))

Regarding your application/WordPress site, what the plugin does ATM is to take the psImageURL property (which it expects to be a relative path from the app's AppHTML directory) and turns that into a fully qualified URL (actually that's slightly not true - it skips the "protocol" part of the URL, relying on the browser to supply whatever protocol is in use for the page). For that to work it expects that you will be using the WPWebResourceManager (I think you must be, otherwise there would be an uncaught error), but also to be using images that are web-accessible. The v19.0 sample now uses a different approach, utilising the DownloadURL mechanism of the WebResourceManager, which is more secure and does not rely on the images being web-accessible. Which technique are you using in your OnDefineImages procedure in the app? Can you post that bit of code?


21-Aug-2017, 02:57 AM
Hi Mike,

we are using the WebResourceManager route:

Procedure OnDefineImages
String sFileName sFolder sUrl

Forward Send OnDefineImages

Move (Trim (ASURLAUB.BILD)) to sFileName
If (sFileName <> "") Begin
Get ABCFolder of oWebApp to sFolder
If (Right(sFolder,1) <> "\") Move (sFolder + "\") to sFolder
Move (sFolder + "XYZ") to sFolder

Move (sFolder - "\" - sFileName) to sFileName
Get DownloadURL of ghoWebResourceManager sFileName to sUrl
Send AddImage sUrl

I guessed that we would need some kind of other resource manager, but I can't find any mention of a WPWebResourceManager (or any ResourceManager) in the library. Just downloaded it again, hoping that we are just using an old version, but in the new downloaded one there is also no WPWebResourceManager to be found.
I guess, that might be the problem?

Mike Peat
21-Aug-2017, 07:44 AM

Sorry - I think I was getting confused with some work I'd already done on a 19.0 version of the plugin, which has a WPWebResourceManager in it (possibly just me experimenting). It adds functionality to get a fully qualified path for things, which is required if you are embedding the app and then using the DownloadURL mechanism.

I need to work on this for a DF 19 version.

For now, try something like this (new code in blue):

String sHome sHost sPort sPath
Integer iPos

Get DownloadURL of ghoWebResourceManager sFilename to sUrl
Move (ServerVariable(ghoWebServiceDispatcher, "PATH_INFO")) to sHome
Move (ServerVariable(ghoWebServiceDispatcher, "SERVER_NAME")) to sHost
Move (ServerVariable(ghoWebServiceDispatcher, "SERVER_PORT")) to sPort
Move (Pos("WebServiceDispatcher.wso", sHome)) to iPos
Move (Left(sHome, (iPos - 1))) to sHome
Move ("//" + sHost + ":" + sPort + sHome + sUrl) to sPath
Send AddImage sPath

That might work "as is", or you might have to sprinkle some "/" separators in there - set a breakpoint in the debugger on the Send AddImage line and see what sPath looks like if it doesn't immediately work.

Note: this should also work outside of WordPress, so you should be able to test stand-alone first.


21-Aug-2017, 09:42 AM
Hi Mike,

worked like a charm. Thanks for the easy fix

Mike Peat
21-Aug-2017, 01:03 PM
Hth! :)