I use KomHttpServer 7.0.2 from SqueakMap
Can you store it as a string? String withAll: ((FileStream readOnlyFileNamed: 'file.bin') binary contentsOfEntireFile)
-- Pavel
----- Original Message ----- From: "David Röthlisberger" davidroe@bluewin.ch To: "'The Squeak Enterprise Aubergines Server - general discussion.'" seaside@lists.squeakfoundation.org Sent: Thursday, April 28, 2005 2:18 PM Subject: AW: [Seaside] Images in a CSS style library
Hello,
loadStaticDocuments
Smalltalk at: #StaticDocumentsRepository put: Dictionary new. (FileDirectory on: (FileDirectory default fullPathFor:
'resources')) fileNames do: [ :fileName | self loadStaticDocument: fileName ].
loadStaticDocument: fileName
| path | path := (FileDirectory default fullPathFor: 'resources'),
FileDirectory slash, fileName.
StaticDocumentsRepository at: fileName put: (FileStream readOnlyFileNamed: path) binary
contentsOfEntireFile.
Thanks.
Basically I do the same as you and pass a byte array to the HttpResponse: (HttpResponse fromStream: img readStream contentType: 'image/png'). img is a ByteArray with the data of the image.
But I get an error when I try to access such an image in the browser: Strings only store characters. I use KomHttpServer 6.2 which uses SocketStreams. Now HttpAdaptor tries to store this ByteArray into the writeStream of the SocketStream, but this write stream is created with a String as the collection, so a ByteArray cannot be stored in this SocketStream. Too bad... Do you use another version of KomHttpServer? I tried 6.1 too, but this
does
not work in a Squeak 3.7 image, i guess...
David
Seaside mailing list Seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/listinfo/seaside
Can you store it as a string? String withAll: ((FileStream readOnlyFileNamed: 'file.bin') binary contentsOfEntireFile)
This seems to work for my png images, yes. :) I have already tried that in the past and then I got an error with some images, but maybe this was because i have not correctly stored these images.
David
seaside@lists.squeakfoundation.org