NetTalk Central
The Rest Of NetTalk => The Rest - Ask For Help => Topic started by: Alberto 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
-
Use the Web Client class and do a simple FETCH.
cheers
Bruce
-
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
-
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
-
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]
-
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.
-
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
-
I notice the link in this thread no longer works - is there another link you can post?
cheers
Bruce
-
Bruce,
It will work wihtin 10 to 20 minutes, when the stock market opens.
Alberto
-
Its working now...
-
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
-
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]
-
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
-
Here you go...
C71 NT5
Thanks
Albertop
[attachment deleted by admin]
-
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.
-
In your example, in the PageReceived method, you're calling the DisplayPage routine before saving the file.
There's no need to call displaypage, or even have it there, because this window will be invisible to the user.
The displayPage routine calls the TextOnly method - which is removing stuff from the PNG - hence your problem.
Cheers
Bruce
-
Thanks Bruce!
Crystal clear!