<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/17612" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2010-02-26T16:08:39-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/17612</id>

		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2010-02-26T16:04:29-04:00</updated>

		<published>2010-02-26T16:04:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92255#p92255</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92255#p92255"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92255#p92255"><![CDATA[
nope, i did not do any modifications to what the convertimg.tcl (thats how i named it) output. but ill try again with your updated code including fconfigure ^^ updating thread in a bit<br><br>//edit1:<br><br>WOHH!!<br>fconfigure gave me a ****LOAD of much more lines this time lol<br>going to import that piece into the main code now, brb ^^<br><br>//edit2:<br><br>DAMN! that worked hahaaaaaa <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>thx again for help nml ^^<br>this rocks big time <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Fri Feb 26, 2010 4:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-02-26T14:53:35-04:00</updated>

		<published>2010-02-26T14:53:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92252#p92252</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92252#p92252"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92252#p92252"><![CDATA[
Oops, -data would be correct. I'll update the post accordingly..<br><br>Did you do any kind of modifications of the generated code (set giffile {...)? The error suggests that the data is not read as valid base64-encoded data.<br><br>I did notice one thing while testing myself, you'll have to use fconfigure to set the -encoding of the input file to binary, or you'll notice the file being distorted/corrupted. Updating this in my previous example as well..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Fri Feb 26, 2010 2:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2010-02-26T13:47:57-04:00</updated>

		<published>2010-02-26T13:47:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92251#p92251</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92251#p92251"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92251#p92251"><![CDATA[
hmm .. looks like im either too stupid for that or it doesnt work ..<br>converting the image seemed to work fine ..<br><div class="codebox"><p>Code: </p><pre><code>set giffile { R0lGODlhDw ..... }image create photo imgobj -data $giffile.c.img config -image imgobj</code></pre></div>i put that set giffile right into the code instead of an external file, decimating eventual errors.. and what comes up next when running that code is:<br><div class="codebox"><p>Code: </p><pre><code>error reading color map    while executing"image create photo imgobj -data $giffile"</code></pre></div>btw: typo in your code ( "image create photo imgobj <strong class="text-strong">-date</strong> $giffile" )<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Fri Feb 26, 2010 1:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2010-02-26T10:12:22-04:00</updated>

		<published>2010-02-26T10:12:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92249#p92249</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92249#p92249"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92249#p92249"><![CDATA[
mhm .. interesting .. <br>and yup .. i was referring to an output .exe after compiling/wrapping ^^<br><br>base64 .. mhm .. very interesting ..<br>ill try your code when im at home later on, looks very interesting. plus i hope that that base64 package doesnt result in an error when compiling/wrapping .. <br><br>let me repeat if i caught what you are trying to tell me:<br><br>the first code part is a one-time-per-image tcl file needed to parse the images "code" (since i tried to open it with wordpad, notepad++ and nano already and didnt show up in plain characters) and to then save it into somefile.tcl which will be used by the image create tk command for each query of that new image, right?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Fri Feb 26, 2010 10:12 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-02-26T14:54:30-04:00</updated>

		<published>2010-02-25T18:03:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92243#p92243</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92243#p92243"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92243#p92243"><![CDATA[
More post-farming :p<br><br>Got the following working nicely:<div class="codebox"><p>Code: </p><pre><code>package require base64set infile "somefile.gif"set outfile "somefile.tcl"set if [open $infile "RDONLY"]set of [open $outfile "WRONLY CREAT TRUNC"]fconfigure $if -translation binary -encoding binaryputs $of [list set imageData [::base64::encode [read $if]]]close $ifclose $of</code></pre></div>This would then be used like this:<div class="codebox"><p>Code: </p><pre><code>source somefile.tclimage create photo imgobj -data $imageData.c.img config -image imgobj</code></pre></div>This works because the gif image class supports base64-encoded data natively.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Feb 25, 2010 6:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-02-25T17:25:51-04:00</updated>

		<published>2010-02-25T17:25:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92242#p92242</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92242#p92242"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92242#p92242"><![CDATA[
Done some testing, and the classic [list ..] trick does not work very well. Most likely NULL or EOF characters are not escaped within the list, which works fine for data already loaded into memory, but wrecks havoc with the source command.<br><br>I did find this article, which uses tcllib and base64 encoding to sort that issue:<br><a href="http://wiki.tcl.tk/1434" class="postlink">http://wiki.tcl.tk/1434</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Feb 25, 2010 5:25 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-02-25T14:15:12-04:00</updated>

		<published>2010-02-25T14:15:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92241#p92241</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92241#p92241"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92241#p92241"><![CDATA[
My bad, when you said build an exe-file, I simply assumed you were developing a tcl/tk-extended software (kind of like eggdrop).<br><br>I guess you're using TclPro's bytecode compiler or such?<br>In plain tcl/tk-space, either set a variable to contain the image data, and use the classic $varname syntax along with the -data option for image. The second option would be to embed the data directly into the image comand in place of the variable...<br><br>You could write a simple tcl:et to generate a script containing the data:<div class="codebox"><p>Code: </p><pre><code>set fd [open "image.jpeg" "RDONLY"]set data [read $fd]close $fdset fd [open "image.tcl" "WRONLY CREAT TRUNC"]puts $fd [list set image $data]close $fd</code></pre></div>Something along these lines would do the trick.. then you'd simply have to include the generated image.tcl script to embed your image as a globalspace variable named 'image'<br><br>Edit: Fixed minor typo in the code<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Feb 25, 2010 2:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2010-02-25T13:13:16-04:00</updated>

		<published>2010-02-25T13:13:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92239#p92239</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92239#p92239"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92239#p92239"><![CDATA[
oh .. my .. god ... oO<br><br>NOW im really confused &gt;_&lt;<br>and nope, im not doing any c or c++ or anything like that - tcl/tk is my home.<br><br>well .. what you are trying to say is that i need to "convert" the image into raw txt, apply a variable to it and use that variable in the image command? any easy ways to convert an image into that raw text i need?<br><br>and maybe less complicated, less c-dependend examples next time please :&gt; i still need to learn and understand ^^<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Thu Feb 25, 2010 1:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-02-24T20:26:57-04:00</updated>

		<published>2010-02-24T20:26:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92233#p92233</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92233#p92233"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92233#p92233"><![CDATA[
Actually, when thinking of it, since we're dealing with binary data, you'd probably be better off creating a new Tcl_Obj along with the objcopy embedding. This way, we can easily contain the NULL character, which would otherwize act as a string terminator.<br><br>I'd look at the Tcl_NewObj() function for this, although Tcl still expects strings to be utf-8 encoded. Tcl_UniCharToUtfDString() might be what the doctor ordered here. Finally use Tcl_SetVar2Ex() to set a tcl-space variable to the value of the Tcl String Object.<br><br>Messy, I know :/<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Feb 24, 2010 8:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-02-24T20:05:41-04:00</updated>

		<published>2010-02-24T20:05:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92232#p92232</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92232#p92232"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92232#p92232"><![CDATA[
Well... in pure tcl-space it would look something like this:<div class="codebox"><p>Code: </p><pre><code>#The actual image data, I'm lazy just using ... for this exampleset imageData {.................}set myImage [image create photo imgobj -data $imageData...c.img config -image imgobj</code></pre></div>Most likely, you'd rather include the image data as a separate file, in C-space. One fairly common way of doing this, is to include it as a header-file, that simply defines a string (constant) with the image data. This kind of packing would usually require some very careful coding, as you'd have to watch out for quotes (") and escapes (\) to get a valid content. You'd probably be best off using a tool for this, though some more advanced IDE's provide means of loading a .text object using an external data source during compilation.<br><br>Once the variable/constant has been declared, you'll have to tie it into tcl-space using the Tcl_LinkVar fuction (remember to pass the TCL_LINK_READ_ONLY flag if using a string constant). It would then be accessible in the tcl interpreter, using the name you've assigned it with the Tcl_LinkVar function, and fully usable with image create -data $myvar<br><br>This article might be of interrest as how you could embed the actual image data into a separate objectfile (.o), suitable for linking, when working with gcc without fancy IDE's:<br><a href="http://www.linuxjournal.com/content/embedding-file-executable-aka-hello-world-version-5967" class="postlink">http://www.linuxjournal.com/content/emb ... rsion-5967</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Feb 24, 2010 8:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2010-02-24T19:40:31-04:00</updated>

		<published>2010-02-24T19:40:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92231#p92231</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92231#p92231"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92231#p92231"><![CDATA[
please be so kind to post me code examples <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Wed Feb 24, 2010 7:40 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-02-24T18:24:48-04:00</updated>

		<published>2010-02-24T18:24:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92230#p92230</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92230#p92230"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92230#p92230"><![CDATA[
Well, you'd have to keep the image as a block in the .text section (accessible through a tcl variable), and use the -data option as opposed to the -file option.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Feb 24, 2010 6:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[raider2k]]></name></author>
		<updated>2010-02-26T16:08:39-04:00</updated>

		<published>2010-02-24T17:59:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=92229#p92229</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=92229#p92229"/>
		<title type="html"><![CDATA[[SOLVED] TK: include images in packages and use them]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=92229#p92229"><![CDATA[
hi guys<br><br>not sure if anyone is familiar with tk in here but id like to know if its possible to recall an image from inside a compiled tcl .exe package. its possible to include it in the compiler without errors but im not sure if its also possible to call that image from inside the package.<br><br>at the moment the image is in the same directory as the exe and is being called by using<br><div class="codebox"><p>Code: </p><pre><code>image create photo imgobj -file "myimage.gif".c.img config -image imgobj</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9589">raider2k</a> — Wed Feb 24, 2010 5:59 pm</p><hr />
]]></content>
	</entry>
	</feed>
