jasperhale Posted December 21, 2015 Posted December 21, 2015 (edited) Anyone please help me, sorry for bad english.I need to download some picture from a website, i use firefox udfBut the problem is, they dont include images to html, but they attach it by encode to base64So the IMG tag look like this<img alt="images" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAASUkqAAgAAAAEABoBBQABAAAAPgAAAn8xWVa+m4P8A/G/iHDYXiLALLsbkbrVnHCwx86uaOjhcTOjNVMLSpSlHmdKTp3m+aEoz0ufbeFf0Vvps+I+XYfjPhzLeFsZwjXrY6VOjiM8isyxFLA4+vhJYWrh4YWaw1eusPKph1UrNzpSpz05ml/dJrN4trpl3crexaf9ntmvRdzymOK0VFLtc3UjP5LQ.............example images in base64 encoded...................3X/Lyt3X/T3y/q7BcR51df7fU1X/Puh/07/wCnXm7dg/4e6fs3f9CT8b//AAm/Af8A88qiiitFw/k+n+w0+n/Lyt/c/wCnnn/VkR/rJnf/AEH1P/BVD/5V5L7j/9k="> Please anyone tell me how to save images automatic.I dont know how to do it Edited December 23, 2015 by jasperhale
PACaleala Posted December 23, 2015 Posted December 23, 2015 one option is to install an addon in FF:https://addons.mozilla.org/en-GB/firefox/addon/save-images/?src=ss
jasperhale Posted December 24, 2015 Author Posted December 24, 2015 This addon save all picture but i want to use AutoIT for automatic download, because my site have only 1 picture in 1 pages, after that i have to go to next pages and save again.Please help !!!
Danp2 Posted December 24, 2015 Posted December 24, 2015 (edited) What have you tried thus far? Show us your code... Edited December 24, 2015 by Danp2 typo Latest Webdriver UDF Release Webdriver Wiki FAQs
ssamko Posted December 27, 2015 Posted December 27, 2015 and what about this ? $linkOfPic="http://i.imgur.com/j3sf8cA.png" $done=InetGet($linkOfPic, "C:\Users\Samuel\Desktop\pic.jpg" ) ; <-- change your location If @error Then MsgBox(0,"Error","Error") Else MsgBox(0,"Success","Success") EndIf
jasperhale Posted December 29, 2015 Author Posted December 29, 2015 (edited) and what about this ? $linkOfPic="http://i.imgur.com/j3sf8cA.png" $done=InetGet($linkOfPic, "C:\Users\Samuel\Desktop\pic.jpg" ) ; <-- change your location If @error Then MsgBox(0,"Error","Error") Else MsgBox(0,"Success","Success") EndIf This work when i have a URL of images, but my site dont have images url, only base64 encode.What have you tried thus far? Show us your code...I use FF UDF for get the source of images tag, save to txt file, after that, i use a base64 decoder to decode the txt file content, and save to a jpg file.I think this is a bad solution, because i missed some picture.Look like this :Local $cc = _FFCmd(".images[0].src")Local $arr2=StringSplit($arr[1],"/")Local $arr3=StringSplit($arr2[2],";")Dim $BufferSize = 0x80000Dim $SrcFile = $fileopenDim $DestFile = $filesavedDim $SrcFileSize = FileGetSize($SrcFile)Dim $SrcFileHandle = FileOpen($SrcFile)Dim $DestFileHandle = FileOpen($DestFile, 2 + 16)Dim $State = _Base64DecodeInit() For $i = 1 To Ceiling($SrcFileSize / $BufferSize) FileWrite($DestFileHandle, _Base64DecodeData($State, FileRead($SrcFileHandle, $BufferSize))) Next I have attach base64.au3 that i'm using here base64.au3 Edited December 29, 2015 by jasperhale attach
Danp2 Posted December 29, 2015 Posted December 29, 2015 I think this is a bad example because your code is incomplete. Here are my suggestions:Post a snippet of code that we can actually run.Forget about Firefox for the moment. Instead, use something like this:Local $cc = "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO 9TXL0Y4OHwAAAABJRU5ErkJggg=="Stop writing the data to disk before you perform the Base64 conversionDrop the For loop Latest Webdriver UDF Release Webdriver Wiki FAQs
Danp2 Posted December 29, 2015 Posted December 29, 2015 @jasperhale,Got your PM. Sorry, but I won't help you with a CAPTCHA issue.Dan Latest Webdriver UDF Release Webdriver Wiki FAQs
Developers Jos Posted December 29, 2015 Developers Posted December 29, 2015 @jasperhale,Unfortunately you appear to have missed the Forum rules on your way in. (there is also a link link in my signature) Please read them now carefully and stop PMing people for help. See you soon with a legitimate question I hope. :)Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts