NetTalk Central

Author Topic: How can I download an image generated by a web page?  (Read 15538 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1846
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
How can I download an image generated by a web page?
« on: March 16, 2010, 06:30:48 AM »
The following url generates a page with an image,
how can I download the image to a file to be inserted in a win32 app?

http://www.ravaonline.com/v2/empresas/graficoid.php?e=fran&n=&w=250&h=120&m=

Thanks
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: How can I download an image generated by a web page?
« Reply #1 on: March 16, 2010, 07:57:51 PM »
Use the Web Client class and do a simple FETCH.

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1846
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How can I download an image generated by a web page?
« Reply #2 on: March 17, 2010, 01:40:47 AM »
I dont understand.
I´m trying with fetch but where are the image? when I d the fetch, how can I save it to my disk to include it in a win32 window?
Any example?
Thanks
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: How can I download an image generated by a web page?
« Reply #3 on: March 17, 2010, 05:56:02 AM »
Hi Alberto,

Once the Fetch is complete, the PageReceived method will be called.
From there you can call the .SavePage method to save the "page" (in this case the image) to disk.

cheers
Bruce


Alberto

  • Hero Member
  • *****
  • Posts: 1846
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How can I download an image generated by a web page?
« Reply #4 on: March 17, 2010, 06:33:40 AM »
Thanks Bruce,

I´m trying, but I dont know the image format I can save.
I´ve tryed with fran.jpg but... invalid format when I want to open it.
Inside, it seams to be a PNG, I rename it to .png but I still cant open it.
Attached goes the image file.

Am I doing wrong?

Thanks
Alberto


[attachment deleted by admin]
-----------
Regards
Alberto

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: How can I download an image generated by a web page?
« Reply #5 on: March 17, 2010, 02:48:36 PM »
The image is PNG.

Go to the web page and right click on the image and do save copy as...

Not that I have done what you are trying to do but your problem may be that the page is php and you are trying to open this as an image rather than as web page. I'm not sure if you can extract the image out of the page once you have fetched it.

Alberto

  • Hero Member
  • *****
  • Posts: 1846
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How can I download an image generated by a web page?
« Reply #6 on: March 19, 2010, 02:04:23 AM »
Bruce,
The image is PNG.
I´m saving it just calling x.SavePAge('fran.png')
It is saved but whe I try to open it, even with the IE, it says the image is corrupt.

Any change I can try?

Thanks
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: How can I download an image generated by a web page?
« Reply #7 on: March 19, 2010, 06:13:54 AM »
I notice the link in this thread no longer works - is there another link you can post?

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1846
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How can I download an image generated by a web page?
« Reply #8 on: March 19, 2010, 06:16:56 AM »
Bruce,

It will work wihtin 10 to 20 minutes, when the stock market opens.

Alberto
-----------
Regards
Alberto

Alberto

  • Hero Member
  • *****
  • Posts: 1846
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How can I download an image generated by a web page?
« Reply #9 on: March 19, 2010, 06:38:11 AM »
Its working now...
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: How can I download an image generated by a web page?
« Reply #10 on: March 19, 2010, 10:34:12 PM »
I created a button in the NetDemo program called "SavePage".
The code under the button is
ThisWebClient.SavePage('c:\temp\a.png')

If I then fetch from your link above, and do a SavePage, then I open a.png in paint, and it's all fine.
So perhaps it's something completely different in your app that's causing the problem?

cheers
Bruce


Alberto

  • Hero Member
  • *****
  • Posts: 1846
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How can I download an image generated by a web page?
« Reply #11 on: March 20, 2010, 04:00:06 AM »
Bruce,
I´m automating the process so in the Page Received ember, after the parent call I add:

   if pSaveAs<>''
      ThisWebClient.SavePage(pSaveAs)
   END

pSaveas is a parameter with the name to ba saved.

I´ve attached the fran.png saved image, I cant still open it.

THanks
Alberto

[attachment deleted by admin]
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: How can I download an image generated by a web page?
« Reply #12 on: March 21, 2010, 08:57:34 AM »
perhaps make a small example, based on one of the web client examples, or the webclient procedure in the netdemo, that demonstrates the effect and post it here. I can't duplicate it from your descriptions so far.

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1846
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How can I download an image generated by a web page?
« Reply #13 on: March 21, 2010, 01:03:25 PM »
Here you go...
C71 NT5

Thanks
Albertop

[attachment deleted by admin]
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: How can I download an image generated by a web page?
« Reply #14 on: March 23, 2010, 11:13:17 PM »
aside: when posting examples from C71 get in the habit of including the cwproj and sln files. They contain information that used to be in the app file in C6. And the settings in there can matter.