Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread Image from database
Wed, Mar 2 2016 3:13 PMPermanent Link

Riaz

Hi. Tim and other members

sorry it's me again, after 4 weeks of trying and trying the databound example, i could not see the image from the database

after a random thought i did this http://epos4u.4irc.com:6005/datasets?dataset=DataBound&method=load&column=ContactPhoto&row=ADF and the image shows

so i added TImage and added this code to test
procedure TMainForm.CustomerRowChanged(Sender: TObject; Column: TDataColumn);
begin
Image1.URL := 'http://epos4u.4irc.com:6005/datasets?dataset=DataBound&method=load&column=ContactPhoto&row='+IDEdit.text;
end;

and it works

have a look http://epos2go.com/databound.html

so is it my computer? or just bugs in the software?

thank,
Riaz
Wed, Mar 2 2016 5:15 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 3/2/2016 3:13 PM, Riaz wrote:
> sorry it's me again, after 4 weeks of trying and trying the databound example, i could not see the image from the database
> after a random thought i did this http://epos4u.4irc.com:6005/datasets?dataset=DataBound&method=load&column=ContactPhoto&row=ADF and the image shows

Yes that's a way to load a specific column.

Images are not actually sent when dataset is retrieved.  When you look
at the actual data that comes back it looks like this (for one record):

    "CustomerID":"ADF",
    "CompanyName":"American Dream Factory, Inc.",
    "Address1":"43 Cherry Street",
    "Address2":null,
    "City":"Langley Falls",
    "StateProvince":"Virginia",
    "ZipPostalCode":"24870",
    "Country":"United States",
    "Terms":"Cash\/Check",
    "Notes":"Can't seem to catch up, always behind schedule.",
    "Contact":"Stan Smith",
    "ContactEmail":"stan.smith@americandreamfactory.com",
    "ContactPhone":"587-555-6200",
    "ContactFax":"587-555-6201",

"ContactPhoto":"datasets?dataset=DataBound&method=load&column=ContactPhoto&row=ADF",
    "ContactPhoto_ContentType":"image\/png"

In order to load an image the image must be then retrieved separately
(i.e.
datasets?dataset=DataBound&method=load&column=ContactPhoto&row=ADF)
which is same as what you found out.

Data bound TImage does this for you automatically - once the dataset is
loaded it sees the URL in the bound data field and retrieves it.

Note that you could use this to retrieve any column if you wish since
all you need is some IDs for the row and column to load :

For example "http://<server
ip>/databound/datasets?dataset=DataBound&method=load&column=City&row=ADF" would
return "Langley Falls".

It is a generic way to load 1 column of data - mostly useful for
images/videos and/or documents (pdf etc) for example.


> have a look http://epos2go.com/databound.html

> so is it my computer? or just bugs in the software?

I'm not sure what you mean by bug ?


Raul
Wed, Mar 2 2016 5:28 PMPermanent Link

Riaz

Hi Raul

the databound has a Timage called ContactImage

ContactImage dataset is set to Customer
ContactImage datacolumn is set to ContactPhoto

is it not true the image from customers field contact ContactPhoto is supposed to be shown in the  ContactImage component, well it does not

i am just following the example that came with EWB to learn

the ContactImage Timage does not display the image

Riaz
Wed, Mar 2 2016 5:33 PMPermanent Link

Riaz

Hi Raul,

i am sure the Timage does not receive the datasets?dataset=DataBound&method=load&column=ContactPhoto&row=ADF

Riaz
Wed, Mar 2 2016 5:42 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 3/2/2016 5:33 PM, Riaz wrote:
> i am sure the Timage does not receive the datasets?dataset=DataBound&method=load&column=ContactPhoto&row=ADF

Riaz,

That is interesting.

I don't have the sample running on my PC at the moment but the one
hosted by EWB (http://www.elevatesoft.com:8081/databound/databound.html)
does work properly - and browser debugging tools do show a separate
request going out for the image loading.

When i get a chance let me try out the sample that ships with EWB (one
posted on elevate website AFAIK is the same one that ships with EWB as
an example).

Raul
Wed, Mar 2 2016 5:48 PMPermanent Link

Riaz

Hi Raul,

you are 100% that the hosted by EWB (http://www.elevatesoft.com:8081/databound/databound.html)
does work properly

that's why i have been going nuts, the example i follow is where i am going wrong

i think Timage has error with handling dataset and column name and ewbsrvr has COR error

please try out the demo and compile it and you will see

thank you

Riaz
Wed, Mar 2 2016 7:52 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 3/2/2016 5:48 PM, Riaz wrote:
> that's why i have been going nuts, the example i follow is where i am going wrong
> i think Timage has error with handling dataset and column name and ewbsrvr has COR error
> please try out the demo and compile it and you will see

Riaz,

I tried out the demo and yes you're correct - "as is" you cannot load
data and EWB app from separate server if you rely on data bound timage.

It's not really a CORS issue but simply how the TImage determines the
URL to load.

Sample application works as designed as long as you host both
application and data from same server (IDE or EWB Web Server for example).

However if one were to host the application on server 1 and then change
the data to be used from server 2 (i.e. changing
Database.BaseURL:='http://<server 2>/datasets'Wink

then you run into this:

1. The app loads from server one (i.e. http://<server 1>/databound.js
file is retrieved etc)

2. Dataset is properly loaded from server 2  (i..e. http://<server
2>/datasets?method=rows&dataset=DataBound)

3. however the image loading defaults back to server 1 (i.e.
http://<server
1>/datasets?dataset=DataBound&method=load&column=ContactPhoto&row=ADF

The last step results in HTTP 404 in this case so no image is shown.

Workaround would be to do what you did and for now not ding the image to
dataset and simply set the proper URL (base url + the column returned)
on dataset change.

Let's see what Tim says as we need his input.

I did some framework tracing and got lost in the TBindableControl - from
what i see it is a normal web component (i.e. timage does not do a
server request or such) so we woudl need a way in this case to override
the base url (or provide full url to timaage and any other such bound
component that relies on relative URL to load data).

Raul
Thu, Mar 3 2016 8:55 AMPermanent Link

Riaz

Thank you Raul for looking into this

Riaz
Thu, Mar 3 2016 9:15 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Riaz,

Raul is correct, there's an error in the way the image handling works in a CORS situation.  Unfortunately, though, this is going to have to wait until 2.05 is released, which is right now looking like mid-to-end of March.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Mar 3 2016 9:16 AMPermanent Link

Riaz

Tim Young [Elevate Software] wrote:

Riaz,

Raul is correct, there's an error in the way the image handling works in a CORS situation.  Unfortunately, though, this is going to have to wait until 2.05 is released, which is right now looking like mid-to-end of March.

Tim Young
Elevate Software
www.elevatesoft.com


Thank you, so it's not me going crazy and pulling my hair out lol
i will wait
Thanks Tim
Riaz
Image