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
Lic. Edgar J. De Cleene wrote:
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
Is the problem that contentTypeGif should be something like contentTypePng?
Tony
Tony Garnock-Jones puso en su mail :
Is the problem that contentTypeGif should be something like contentTypePng?
Tony : Thanks for the tip. Adding to:
MIMEDocument class contentTypePng ^'image/png'
Still don't work
Edgar
___________________________________________________________ 1GB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo http://correo.yahoo.com.ar
Finally I solve my own questions.
Here I share the interin solution.
asWebImage | aStream writerClass imgType| aStream := RWBinaryOrTextStream on: ''. writerClass := ((Smalltalk includesKey: #JPEGReadWriter2) and: [(Smalltalk at: #JPEGReadWriter2) new isPluginPresent]) ifTrue: ['jpg'] ifFalse: ['gif']. (writerClass = 'jpg') ifTrue: [writerClass := JPEGReadWriter2. imgType := 'image/jpg'] ifFalse:[writerClass := GIFReadWriter. imgType := 'image/gif'].
Thanks to who answer and who view Rosario images. Now I share Argentina views on :
http://200-122-104-133.cab.prima.net.ar:8084/
___________________________________________________________ 1GB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo http://correo.yahoo.com.ar
squeak-dev@lists.squeakfoundation.org