Code Creator and Images loading

solution84

Client
Регистрация
11.06.2013
Сообщения
7
Благодарностей
1
Баллы
0
Hello,

I have this code:

instance.LoadPictures = false;
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByTag("form", 0).FindChildById("image1"); //THIS IS IMAGE SAMPLE
string recognition = ZennoPoster.CaptchaRecognition("DeCaptcher.dll", he.DrawToBitmap(false), "");

Is there a way to download image only witihout set instance.LoadPictures = true ?

I need to download only image element not all images in documents
 
  • Спасибо
Реакции: TeslaSoldier

shade

Client
Регистрация
19.11.2010
Сообщения
580
Благодарностей
346
Баллы
63
Hello,

I have this code:

instance.LoadPictures = false;
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByTag("form", 0).FindChildById("image1"); //THIS IS IMAGE SAMPLE
string recognition = ZennoPoster.CaptchaRecognition("DeCaptcher.dll", he.DrawToBitmap(false), "");

Is there a way to download image only witihout set instance.LoadPictures = true ?

I need to download only image element not all images in documents
If you want to load image only for one element you should do next:
1. get the src attribute of the html element
2. set LoadPictures as true
3. set the src attribute of the html element (Will be loaded only one image)
4. set LoadPictures as false

These actions must be between searching of the element and recognition
Here code:
JavaScript:
HtmlElement he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByTag("form", 0).FindChildByAttribute("img", "fulltag", "img", "text", 0);
if (he.IsVoid) return -1;

// get src attribute
string url = he.GetAttribute("src");
// set LoadPictures as true
instance.LoadPictures = true;
// set src attribute to the element
he.SetAttribute("src", url);
// wait downloading
System.Threading.Thread.Sleep(2000);
// set src attribute as false
instance.LoadPictures = false;

string recognition = ZennoPoster.CaptchaRecognition("MonkeyEnter.dll", he.DrawToBitmap(true), "");
 

Вложения

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)