1. mathews rutto
  2. PowerBuilder
  3. Monday, 8 July 2024 09:20 AM UTC

Hi,

 

How to view .tif i have tried picture control and webbrowser with no success.

p_1.PictureName = 'https//xxxxxxxxxxx/name.tif'

 

wb_1= 'https//xxxxxxxxxxx/name.tif'

 

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 8 July 2024 12:50 PM UTC
  2. PowerBuilder
  3. # Permalink
Shouldn't you use "LoadPicture()" as stated by Andreas before ?
Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Monday, 8 July 2024 12:57 PM UTC
  2. PowerBuilder
  3. # 1

From some tests I did, I see that readdata fails... It's a shame... GetResponseBody seems to get the beginning of the result, but not all the response. I guess it's related to the content sent. It starts with "II*" and followed some special characters but everything after "II*" is truncated (I guess some null?)...

It's a shame because curl can download and save the tiff to a file. But I cannot read the file using fileopen (probably due to the reason mentioned before)...

But this works for me:

long ll_fileno
string ls_command = "curl http://localhost/aaa.tif -o ", ls_filename = "C:\SomePath\aaa.tif"


run(ls_command + ls_filename, minimized!)
// I put some delay to be sure that the file is downloaded.
// Instead you could use Roland's Smith RunAndWait (https://www.topwizprogramming.com/freecode_runandwait.html).
sleep(1)
ip_1.LoadPicture(ls_filename)

// The image is deleted after loading.
if fileexists(ls_filename) then filedelete(ls_filename)

Andreas.

Comment
  1. mathews rutto
  2. Monday, 8 July 2024 13:34 PM UTC
I am glad that this works for you.
  1. Helpful
There are no comments made yet.
mathews rutto Accepted Answer Pending Moderation
  1. Monday, 8 July 2024 12:53 PM UTC
  2. PowerBuilder
  3. # 2

It has worked i am happy.

This may help some-else

 

Blob lblb_photo, lblb_NextData
HttpClient lnv_HttpClient
string ls_response

lnv_HttpClient = Create HttpClient

// Not to read data automatically after sending request (default is true)
lnv_HttpClient.AutoReadData = false

// Send request using GET method
li_rc = lnv_HttpClient.SendRequest("GET", "url link")
lnv_HttpClient.GetResponseBody(ls_response)
messagebox('',ls_response)
// Receive large data
if li_rc = 1 and lnv_HttpClient.GetResponseStatusCode() = 200 then
 do while true
  li_rc = lnv_HttpClient.ReadData(lblb_NextData, 1024*16)
  if li_rc = 0 then exit // Finish receiving data
  if li_rc = -1 then exit // Error occurred
  lblb_photo += lblb_NextData
 loop
end if

ip_2.LoadPicture(lblb_photo)

Comment
  1. mathews rutto
  2. Monday, 8 July 2024 15:44 PM UTC
Is there a way i can zoom in and out in inkpicture?
  1. Helpful
  1. Chris Pollach @Appeon
  2. Monday, 8 July 2024 19:20 PM UTC
Hi Mathews;

No, the Ink Picture & Ink Edit controls are not zoomable.

However, the Ink Picture & Ink Edit feature within the DataWindow IS zoomable.

Also, I've used the TableBlob feature of the DW for this as well. Food for thought!

HTH
  1. Helpful 1
  1. mathews rutto
  2. Tuesday, 9 July 2024 06:10 AM UTC
i have done that, so how do i assign to be displayed on the data window?

I have dw_1.object.blob_1= lblb_photo
  1. Helpful
There are no comments made yet.
mathews rutto Accepted Answer Pending Moderation
  1. Monday, 8 July 2024 10:55 AM UTC
  2. PowerBuilder
  3. # 3

 

Comment
  1. Andreas Mykonios
  2. Monday, 8 July 2024 11:05 AM UTC
What is the value of lblb_photo at the end? Is it valid binary data?
  1. Helpful
  1. mathews rutto
  2. Monday, 8 July 2024 12:42 PM UTC
Blob lblb_photo

ip_2.LoadInk(lblb_photo)

  1. Helpful
  1. Andreas Mykonios
  2. Monday, 8 July 2024 13:01 PM UTC
Yes... I didn't paid attention to the way you tried to load the blob. In my tests, I wasn't able to readdata to blob. The blob remains null. Glad this worked for you.

Andreas.
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Monday, 8 July 2024 09:45 AM UTC
  2. PowerBuilder
  3. # 4

Hi.

In your example you are missing a ":" char.

p_1.PictureName = 'https://xxxxxxxxxxx/name.tif'

Picture controls do not have support for tif. If you absolutely need to display a tif image file, then try using webbrowser control or inkpicture control...

Andreas.

Comment
  1. mathews rutto
  2. Monday, 8 July 2024 10:21 AM UTC
Is the a way I can download a file from the API and then store it in a variable?

From there I can use the variable to display.
  1. Helpful
  1. Andreas Mykonios
  2. Monday, 8 July 2024 10:26 AM UTC
Sorry. I was wrong. InkPictrure control's LoadPicture supports blobs. That way you could load the image directly. I don't know if you could use httpclient and readdata function, to get the image to a blob.

Andreas.
  1. Helpful
  1. mathews rutto
  2. Monday, 8 July 2024 10:57 AM UTC
From the screenshot I have shared how do i assign the blobs to InkPictrure ?
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.