Sign in to follow this  
Followers 0
Andreik

Embed image in HTML

4 posts in this topic

Hey, I have this piece of code but I can't figure out why I cannot see this embedded image from my HTML file. I have a function that will create a sample HTML file. If I open this file with Mozilla, the image will be display without any problem but if I try to use a Shell.Explorer object to display this file my image will not appear. Know anyone why?

$OBJ = ObjCreate("Shell.Explorer.2")
$MAIN = GUICreate("Test")
$CTRL = GUICtrlCreateObj($OBJ,5,5,390,390)
GUISetState(@SW_SHOW,$MAIN)
CreateHTML()
$OBJ.navigate("file://" & @ScriptDir & "\Test.html")
$OBJ = 0

Do
    Sleep(10)
Until GUIGetMsg() = -3

Func CreateHTML()
    Local $CONTENT = '<html><head><title>Example</title></head>'
    $CONTENT &= '<body bgcolor=#C0C0C0 onselectstart="return false" oncontextmenu="return false" onclick="return false" ondragstart="return false" ondragover="return false">'
    $CONTENT &= '<center><h3>This is an example</h3></center><br>'
    $CONTENT &= '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAA5CAIAAABPkBkqAAAACXBIWXMAAC4jAAAuIwF4pT92AAAA' & _
    "BGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VG" & _
    "AAAPfklEQVR42uybd1gTWffH70ySmfQAoYkSpCiKFAUEJDTFtVBExFVRwLIqFiw/dV1Xd3+Lrr2L" & _
    "be0NKyyigIiuCigqJS4IdpEiBiEQAimQMjPvH1FAVwXfVd5lH75P/sk8996587nnnnPumQQiCAJ0" & _
    "qX2CuxB0wfofwRJW1T0uft1Fql2wdNj07D9LziTldcGC2uPgCUCcTRYUPXn93fhB5j24XbDaVt79" & _
    "8kPn7g7zsg4e5tAFq201yJu2HrqB4fi8MC9DfVYXrLZ17fbTs0n5IX52wz37dsFqWyKxbNuRG1QU" & _
    "WTjVh81Au2C1rTPJ91IzHs0J83B1MOuC1baelVZHx6T1tTJePssXhv/lKe7ffbxePQ0PrB1XIZT4" & _
    "f3eouKy6YyatalSIHhQpasWd77hDp6K/rf7W1trQN2x/4tXCrzpdZUND2ZW08tRUmERCOexOtg1b" & _
    "a+mGpM0Hbq2Y4/1T1FAUQb6wNUmlpRcTZKWlRu78bl6DYRKp8/ms1tJgmvHzTyVcehA0vPeelSEm" & _
    "RjpfZNgmiaTk7Onq7CxjTx+LcaEUBqOzOvj3VFFZOzTicEmFxKaX/sE1IU52vL8zmqK25tnhA5Vp" & _
    "aQZ8T+vIWUyT7p07Gv5VWw9m/LzjDzIJ1telxW4ZN8jR4r8YRF5d9SL22IvYo0wLK7vlvxg6Ov0b" & _
    "UocP5Ku1Dd4T94vECjWG6bLQMztCXfubt7+7TPiqJO5s8eF9JIjUZ8kyq7AI6F+TZ31QkSviTiYV" & _
    "shmIvFHN68ZOPjTZzES/zV7S169fnDhafvK4vKLcLHyq/Y8/MwwNv8YzEwQhFotxDKuvl8hlcpt+" & _
    "/SjtC0dfJY10GWAKAEEAwKBTSl/WL1qdolJrPuXC6+oe7I7JDPJ/uDYaoqLux08P2rbzK5HS6tyZ" & _
    "0x5uLkO8PKaETZQrFB2XZ/1Vlmb6FDJMEIAgAJOFXM58ejb53ocxSRueHD+aPjrg0ZqVjS9LeRPC" & _
    "Biek8PwCv+5ugqDI2XMmhUfUicUolUqhUNrZkfxVMl3oHT9DppAOxd0b5zcARSkAAAIACAC1SlWe" & _
    "mPB83x7Zs6cEgZN1ONZLlvWZNrNjPBQMw3b2dhAEIQhCgkn/S1jFJSK1Bqe+LUagCLm4XCysqjPn" & _
    "GQIAIABe3bj+NGabWJADU1AIQCivp+PGLSZ8z4701hoNBgBAKBQS6SvAUijk4loxiiIGhkafbnlL" & _
    "UAqBFhPBMYLBITNZNABAQ1nZw60bhSlJANOQGUy1VKrvzufv3kcxMKyvlzQ0SBlMxt6du1zd3Hx8" & _
    "fWEYxjSapqZGlVKlx+VCEAQAqKkREQRhYPCORxOJqgmCMDQ0AgDgOA4BoME0jYpGHMd1dHW1bSor" & _
    "hTAEGRl3azYuAhAk5AOwmhqbasU1JBLJ+G3jz/BZ6Teuh44d6+bkOMjFke/mGhI8+tHDBx/PS8U3" & _
    "ckqp1JZlkDeqRvs5GOiyXsSdyfx29KuEcyQyBabSVNIG8/GhHsdOXcnLCwkMcHUcwHdxGuLJ37lj" & _
    "y6L5Uc8eP46YGDqY7853cY6aOweCoLo6cdTsSE83F083l9WronEcBwCIa2vnzp7l4TbQy9116aIF" & _
    "arVK+EoYEhzs4+Hu4tR/y+aNAIALiQlDB/vwXQd6ewwKHTf2RXGx1nMBAlAoCExqgSDIy5sWETZo" & _
    "oOOggU5814Ejh3+TfefOO3H0E1IoFAujovQ57Enjx8XHnUuIj3NzdkJh4D9imFqt/mCXHzel0Pv9" & _
    "ZOz2q/aj5/hLb7/tz0uE+b+siOcZJ1iaJtpYJVqbx5kaFa6JrmuQTJkSwWFQnfs7jBk1Ksjf39nB" & _
    "zpir49zfTqlsyshIt7awoJPhOZEzJRKJjwdfj0E3MzEy0GFx2Yzc3By5QjHY04NNQ3p2NzbUZbOo" & _
    "5MSEeBzHUy+lmJuaUMnQ1k0b9u7ayWGg/W37ujkPMNRlMynkbwb7qFSqi4nnGQg8OtBPO20Mw36N" & _
    "jjbgcEb7+5+KPZGcdGGYrw+NDLk4OkgkEm2bT8FSKZURkyYwEXLcmTMtLL5fwkRIjva2Mpn8r11u" & _
    "CZ4Zua4yHLhKS8rQZaWe67ojx//ImxZ6zoSb2Mcisa/leWvz33lGj2K2y9Uq3yE+A+xsMzLSlcom" & _
    "7Qh3b98x5LC8PdyUKiVBELMjZ6AwWL9m9eSJob5e/IcPiu7fL3AeYMdGKLt3xiyMihrQzzYvN/fJ" & _
    "kyd814EslBQ1K1I7zoSxIXosuq+nRx9Ly6SkiwqFXC6XHz54wERfl8tmCPIEV65cplPgb8cEadsv" & _
    "WbQAAWDXjh3Nz/Lbrl1sKrlnD5Py8nLtlU/5rKNHDsWePLNs2dKx48drr9y5fTs56aJGjXn5eNMZ" & _
    "9PfaV4ok81cmN6kwGkrW2qxcA80cbmJ9cVtZdi7CeXOu1shlvebM7zNvwcIFUZUVwvTMTAOjFieY" & _
    "m5stk8npdCaFTAEAEDjOoNNSki5qNFjy5TQ9LhcA4OXl/fzxs9jjxxrqGxJTUqysegEAvLy983Jz" & _
    "q6qqmncMCYYFAsG+g4cCAt7kIlO/m/7H1bTzv/9eXV2FoggBCARBAQDJFy/EbI8Jnxoxd/58bcui" & _
    "wqITJ46rlJpB7oO6devWhoPHMCwhPo5FRwe584sKC3Nz7qalpl5NuwIgImLatJW/rnkvxksVysif" & _
    "zj95UctmoQQBcJyQqTST/fsEl/xelZtLYrIBIAAAGpnUJCjIftmKgoKC44cP7z1wuDUpAEBqagpM" & _
    "gmlUmtadQxAEwXDh/YIDh49pSQEA9PQMYBJUVHj/h+UrtKQAAFwulyAAhUx+m77AKqXSwdF59JiQ" & _
    "1uNbWfYicILL5cpkUkAAFEUBAOcT4mFA8PmeTx4/FuTlXE1Lu5yaqlDIg8YEb92xk/x2TPLHY59C" & _
    "JKphMOgrlv3QqFBgGqybSbc586ICg4JdXF3fa9wgbZyy9Ny12y/YTJQggFqDKdX44pneIcLLJVk3" & _
    "ITpLSwpXKplWVo6rN0AQlHLxAo5jDg72rce5knb5Xl4eg8HQLrgWllqt6t3beoSfX3MzFEE0Go1x" & _
    "t27hk6e0hCoSiSAAm91SEWxSqfkefAR95yjz/OnT7qam/Wxts25lAgCoVCoAQCisZHNY2zZv2rB2" & _
    "rUqpNDAymBgeNipojJe3N9QqZ/woLARBqDSqTCYfOtxxzboNTAaDzeF8sMpeWS2Z/mN8Rk4pm0mF" & _
    "ACRTqFhMyrbo4AB96c0tpwGN0RJKcKzPomVUHT0AQMXLckyDi8UtpeH6+vpV0dHBo8ekJCc1Z9UQ" & _
    "DCmV6oGubkxWy2tKCIbVKnVv6z4805YSEIHjOABcA/1myoAA5haWraf65z1BcnLyqjVr6XQ6psEI" & _
    "gkAQBABAp9MbFY1m5uYxu/fqsDksDrvZmtqVOqAoyufzMUyTfevWnawsjo5OM6kakSgnJ0cbuYue" & _
    "CINnn0jPLWUzqWoN1tDQ5OHES9o3Ody/X/7G9WpcA0FvemHKJp0BTqYj3xgInU7DcGzTurVFhfdr" & _
    "a2qy79weHejfk2cWNnlKfV1d81whABE4cHJ2fu8orMGBnb0DaLXsOEEQAOjpN8MCJAgy6d5SAiso" & _
    "KJgSHu4fOGr23CgtcQCAdlW8fXxwgigsyL9yOZXBYjbfvaG+/u6dO0qlsu2kdPH3y3Kzc3KzsyNn" & _
    "TNu3d7edfX8KhfKyoiwr41Zg0CgXF5dL6Q/nr7wokjSy6Gi9TGmkT/95rvecMD6FTBEV/CkpyCdR" & _
    "WwUBjdo0OKS5HDzcL+DIkSOZmemBI4fTGYzysjIbW7sde/bU1NQQEFCpVG+wAIIAgGtg0HpiOIFr" & _
    "AGhtVgAACoICADhvtyEEwQhKiT12tKZaRCKTBbk5J0+eGDki4LeDB7UbE4YgDHsDa9r0GZk3MtJS" & _
    "L/2wZFHs8aMDHJ1pdPrryle3b2bZ2tnHJSa2DcvQyOjUufg1q6KvXr2Sn38vN/sunU43N7f48ecV" & _
    "k8LDdsXejN5xHcMIHIc0OB4+2n7JdC8rszfemmhSEAQBt7IFiEbXc+jffOGbYcNXr12/bcumeolE" & _
    "rVaHjBu/YeMmLpfLZDKHfDNMJKp6a/kwk0lls1jvBh8NHUE4HM47pQ4XVwaCNlsBBEMIgmZkpKem" & _
    "JJPJJF5P881bt4VPntrsgyAIQlEKW0cHAMBksg4dP7Zh7ZqkC4lPHj8uyM+nUak9ephNmT79uxkz" & _
    "Wsy8PfWs15WVQuErnMD1ufo9zS2a1GDeL/Gnk/JxAlBR8ghPq4XTPF3s33nPqqiuuh4wXC2pg99k" & _
    "ABiJyhh88RKT9445CIWvKipe6unpWVn1bgmsUunLl2U2NrYAgPLSMrVGbcozbXb5AAChsEIqlfNM" & _
    "eTQ67Z2TxrVrGIH5Dh0GAIgIDU1NTj4ce8Kke3cajWZp1Usb+Fq5SEmlUNjDlMdkMpsv1ohqKirK" & _
    "1Rq1rq6eqSnvvS6fXfy7JShevDo5p1DIZqLeruYLItx9+dYfKLABULB5/bPtmxG2zltYVJ/EVFbP" & _
    "nh1zTo4InXDlcmpWrsDSyupLjfkZB2mpvHHHkVvr92cq1ZoR3lazQ11HDbX/aM0IgD4zZ4uuXZM+" & _
    "KiLRGQCC1ApZU011h8ECAJApZNIXfWPWXlgZOc8Wr0sV5Ff4elnNnugSPMwOhtqYB5XNcdy0NSts" & _
    "PCaTwgiKN6lq7gkMnF06hpRCoVCp1VQarUNr8DV1slUxVw/FC/rbGH8/3StgiA2Z9Bn2WH71cl5U" & _
    "JAkDGIGzbex8zieRyR3xfjT+7FkyQvEPCGx/IfRvwcJxPDZRsH7/DR0WY/F0z6Ch/cj/lVWXpSTn" & _
    "//B/uEJBAMhp134zP7+35dJOpo/Cysx9sfnAdaUKnzeZH+DTF0B/q1ovzLr55+KFTSUvmA52Pgkp" & _
    "KLNT/mrwA7Cel4kOnrtTWSWdEDBgpI/Nl7pT3fNngiULRenXraLmD1y9odPDqhZLk64VVYoa3Pub" & _
    "D3Hv/cVv1ihtKNqwrvjAXvv/X2Uzd37no6Uta8kVTVmC58fPZ+cUlhJfWc/PnEroa1W0c7v2K050" & _
    "Gr2xrJKyKgIiLHjGHbNCdUVFguXf6zkNtF/+E5mCdGKf1THCVKqimM2y0jL7pctZPLMuWO2Ikhnp" & _
    "JXFnTUcF8ob5dcFqW0214od7Y0hUtG9kFMJidcH6eHh5m5u+TEt9mZZqETLOmO/RBattySqFj37b" & _
    "Q9Xn9pkxi0KldcFq29CKz54S3y+0DJ3EtbXtgtX2nmwofv4s9piBqxtvhH8XrHYkFhr1i/hzJBrD" & _
    'zN+fRKZ0wWpb4uLnVH0jGocFdcH6rHD5T9A//a9J/6ii138GAPsCZPaWkcB1AAAAAElFTkSuQmCC" width=100 height=57>'
    $CONTENT &= "</body></html>"
    $FILE = FileOpen("Test.html",2)
    FileWrite($FILE,$CONTENT)
    FileClose($FILE)
EndFunc

When the words fail... music speaks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Ahhh, is there any alternative way to do what I want? I want to have just one HTML file with all content (can include a photo or not).

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Look at my HTML example (resource_test_ie.au3 inside resource_au3.zip) in my Resource topic.

It's exactly what you want.

Link is in my signature.

Edited by Zedna

Share this post


Link to post
Share on other sites

Yeah, but is one more problem because I don't know before compile my script what pictures I will use. Actually I have a script that decypt an ecrypted AES file as a HTML file and then load it in some way in my GUI. This is what I`m trying to do. I cannot use resources because I don't know before what kind of HTML file will be and the content of this file.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0