diff options
Diffstat (limited to 'main.scm')
-rw-r--r-- | main.scm | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -1,5 +1,5 @@ (import - scheme (chicken base) (chicken foreign) + scheme (chicken base) (chicken foreign) (chicken file posix) (chicken format) (chicken port) (chicken io) (chicken random) (chicken time) (chicken process-context) (chicken irregex) (chicken condition) (chicken blob) spiffy intarweb uri-common html-parser spiffy-request-vars multipart-form-data @@ -145,11 +145,18 @@ raw-img-vec (u8vector-length raw-img-vec))) -(define (set-exif-orientation! raw-img orientation) - ((foreign-lambda void "setExifOrientation" blob unsigned-int unsigned-int) - raw-img - (blob-size raw-img) - orientation)) +(define (set-exif-orientation raw-img orientation) + (let-values + ([(fd file-path) (file-mkstemp "/tmp/image-temp.XXXXXX")]) + (file-write fd raw-img) + (file-close fd) + ((foreign-lambda void "setExifOrientation" nonnull-c-string unsigned-int) + file-path + orientation) + (let + ([port (open-input-file file-path #:binary)]) + (u8vector->blob/shared (read-u8vector #f port))) + )) (define dim-max 512) @@ -185,11 +192,9 @@ target-height channels) )))]) - (set-exif-orientation! resized-jpg orientation) - resized-jpg + (set-exif-orientation resized-jpg orientation) ))) - (define users (alist->hash-table '(("lawrence" . "pw") ("demo" . "pw") ("dan" . "pw")))) (define apikeys (make-hash-table)) |