How do I embed GIFs in a change-set?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I embed GIFs in a change-set?

KenDickey
Greetings,

I have updates a morphic based FreeCell card game I did a few years ago to
3.8.  I would like to put in into SqueakMap (or wherever) but the changeset
file-in requires a directory of GIFs (the card images) to be in the working
directory for import into the image.

What is the best way to do this?


Thanks much,
-KenD

PS: please CC replies to [hidden email] as I am not subscribed to this
list.
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
-KenD
Reply | Threaded
Open this post in threaded view
|

RE: How do I embed GIFs in a change-set?

Ron Teitelbaum
Hi Ken,

The thing to remember is that files are just collections of bits.  You can
take the bits and convert them to a compact string, then expand that string
when you need it to create a new file.  The compact string can be placed in
a method and saved as part of a change set.  

The main issue with GIF is that you need to change the stream to binary.  

Here is an example from seaside:

seasideBanner
        "This is a copy of
http://www.netstyle.ch/include/seaside/pics/top.jpg"
        "(((
                | mimeDoc |
                mimeDoc _
'http://www.netstyle.ch/include/seaside/pics/top.jpg' asUrl
retrieveContents.
                Clipboard clipboardText:
                        (Base64MimeConverter mimeEncode: mimeDoc content
readStream) contents
        )))"
        ^self base64Decode:
'/9j/4AAQSkZJRgABAQAAAQABAAD/2wB [...snip...]
BPpS0UAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAF
FFFABRRRQB//2Q=='

base64Decode: aString
        ^ (Base64MimeConverter mimeDecodeToChars: aString readStream)
contents
               
You can see in the comments of the seasideBanner how then got the string to
store.  I had to change the code some and wrote a retrieveBinaryContents for
3.9.  You just need to send the message binary to the stream to convert it
to a binary stream.

If you need a more detailed explanation please let me know.

Hope that helps!

Ron Teitelbaum

> From: Ken Dickey
> Sent: Tuesday, October 03, 2006 11:35 AM
>
> Greetings,
>
> I have updates a morphic based FreeCell card game I did a few years ago to
> 3.8.  I would like to put in into SqueakMap (or wherever) but the
> changeset
> file-in requires a directory of GIFs (the card images) to be in the
> working
> directory for import into the image.
>
> What is the best way to do this?
>
>
> Thanks much,
> -KenD
>
> PS: please CC replies to [hidden email] as I am not subscribed to
> this
> list.
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners