On 12.11.2012 14:54, Emilia wrote:
Hello! I'm porting code from Cincom Smalltalk to Pharo. It's a web application so I've got several WAComponent instances and one component which inherits from WAFileLibrary that renders images. In the original code ( the one that runned in VW) i had the following instance method in the component that inherits from WAFileLibrary:

logoJpg
^ByteArray asPackagedString: '?=#?8@@PR$YIQ @A@ D@X@A @@C?8P))QW!)Y @@RT$*@@ @@@@G@AHA@[email protected] etc'

But now when i run it in Pharo the debbugger doesn't recognize #asPackagedString: message.

Does anyone know which method should I use in order to render that image?

Thanks in advance!
Mercy beaucoup!

Emilia

fromPackedString: uses a (proprietary?) format to store a bytearray in source code, there are no method for reading the string as is in Pharo directly.
The equivalent in Pharo would probably be something like:

^Base64MimeConverter mimeDecodeToBytes: 'myImageInAStringThatsSafeToStoreInSource' readStream contents
(See ThemeIcons use of xxxContents methods for an example)

To convert, you'd have to serialize your images to disk first (leaving you with .jpg files), then read them in and convert (f.ex. using a Base64MimeConverter) to an appropriate format for storing image bytes as methods in Pharo.

Cheers,
Henry

Reply via email to