Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Thumbnail And Scaled Image Producer Doit
Last updated at 7:48 am UTC on 16 June 2018
 "1" dir := FileDirectory on: 'd:\\images'. "add some image files to this directory first"
 dir keysDo: [:name |
 	form := Form fromBinaryStream: (dir fileNamed: name).
 	JPEGReadWriter2
 		putForm: (form scaledToSize: 512@512) onFileNamed: 'scaled_',name;
 		putForm: (form scaledToSize: 80@80) onFileNamed: 'thumb_',name] 
 
 (Merged some of Geoff's changes to make it work)
 
 Geoff: I spent quite some time hacking on this. Thanks for the suggestions.
 Fixes -

Instead of "1" you might want to use

 dir := FileDirectory default directoryNamed: 'images'. "in default dir"

Other note
 form := Form ... " Object(false) doesn't understand... - eventually it hit."
    JPEGReadWriter2 "depends on image type?"
    ... onFileNamed: (dir fileNamed: 'scaled_', name) fullName; "make in the same directory, do it more than once for fun."