Web photo viewer

Lic. Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Sun Nov 27 11:45:58 UTC 2005


I wish have a Web photo viewer using HttpView

HVTransientView subclass: #HVRandomPhoto
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: ''
    category: 'HV-examples'

default
    
    | listaArchivos  image myStream choose dirName |
dirName := 'Discovery:Users:admin:Pictures: Rosario:'. "here I select my
starting photo folder"
listaArchivos := (FileDirectory on: dirName) entries select: [:ea| ea
isDirectory not]. " I wish files, not directories "
listaArchivos := listaArchivos copyWithout: (listaArchivos at: 1). "this is
OS X , not a photo "

choose :=  (listaArchivos atRandom) name.
myStream := (FileStream readOnlyFileNamed: dirName,choose) binary.
image := Form fromBinaryStream: myStream.
myStream close.
image :=image scaledToSize: 360 @ 270.
image borderWidth: 2 fillColor: Color red.
 ^image

Copy of old Comanche

Form

asWebImage
    | aStream |
    aStream _ RWBinaryOrTextStream on: ''.
    GIFReadWriter
        putForm: (self asFormOfDepth: 8)
        onStream: aStream.
    aStream reset.
    ^ MIMEDocument contentType: MIMEDocument contentTypeGif content: aStream

This works , but dithered.
Changing form depth don't help.

Changing mtethod to:
asWebImage
    | aStream  writer  |
    aStream := RWBinaryOrTextStream on: ''.

    writer := PNGReadWriter on: aStream.
    [ writer nextPutImage: self ]
        ensure: [writer close].
    ^ MIMEDocument contentType: MIMEDocument contentTypeGif content: aStream

Don't work

I wish if any have advices as how I could do this.

The service is running at http://200-122-104-133.cab.prima.net.ar:8084/ and
you could see Rosario city photos.

Thanks in advance.

Edgar



	

	
		
___________________________________________________________ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 




More information about the Squeak-dev mailing list