Index: openacs-4/packages/photo-album/www/photos-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photos-edit-2.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/photo-album/www/photos-edit-2.tcl 10 Jun 2003 10:07:11 -0000 1.1 +++ openacs-4/packages/photo-album/www/photos-edit-2.tcl 12 Jun 2003 06:55:45 -0000 1.2 @@ -50,51 +50,6 @@ ad_returnredirect "album?album_id=$album_id&page=$page&msg=1" -proc pa_rotate {id rotation} { - if {![empty_string_p $rotation] && ![string equal $rotation 0]} { - set flop [list] - set files [list] - - # get a list of files to handle sorted by size... - db_foreach get_image_files { - select i.image_id, crr.content, i.width, i.height - from cr_items cri, cr_revisions crr, images i - where cri.parent_id = :id - and crr.revision_id = cri.latest_revision - and i.image_id = cri.latest_revision - order by crr.content_length desc - } { - ns_log Notice "pa_rotate $id $rotation [cr_fs_path] $content $image_id $width $height" - if {[catch {exec convert -rotate $rotation [cr_fs_path]$content [cr_fs_path]${content}.new } errMsg]} { - ns_log Notice "Failed rotation of image $image_id -- $errMsg" - } - lappend flop $image_id - lappend files [cr_fs_path]$content - } - - # rename files in catch. - if { [catch { - foreach fnm $files { - file rename -force $fnm ${fnm}.old - file rename -force ${fnm}.new $fnm - } } errMsg ] } { - # problem with the renaming. Make an attempt to rename them back - catch { - foreach fnm $files { - file rename -force ${fnm}.old $fnm - file delete -force ${fnm}.new - } - } errMsg - } else { - # flop images that need flopping. - if {[string equal $rotation 90] || [string equal $rotation 270]} { - db_dml flop_image_size "update images set width = height, height = width where image_id in ([join $flop ,])" - } - } - } -} - - foreach id [array names d] { if { $d($id) > 0 } { pa_rotate $id $d($id)