Index: openacs-4/packages/photo-album/tcl/photo-album-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/tcl/photo-album-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/photo-album/tcl/photo-album-procs.tcl 12 Jun 2003 06:55:45 -0000 1.2 +++ openacs-4/packages/photo-album/tcl/photo-album-procs.tcl 12 Jun 2003 18:05:05 -0000 1.3 @@ -354,7 +354,11 @@ be used for both width and height. ImageMagick will retain the aspect ratio of the base_image when creating the new_image - + + jhead -dt is called to delete any embeded thumbnail since digital camera thumbnails + can be quite large and imagemagick does not remove them when converting (so thumbnails + can end up being 8k for the thumbnail + 32k for the embeded thumbnail). + @param base_image original image filename @param new_image new image filename @param geometry string as passed to convert @@ -365,7 +369,8 @@ set geometry ${geometry}x${geometry} } ns_log debug "pa_make_new_image: Start convert, making $new_image geometry $geometry" - exec convert -interlace NONE -geometry $geometry $base_image $new_image + exec convert -geometry $geometry -interlace None -sharpen 1x2 $base_image $new_image + exec jhead -dt $new_image ns_log debug "pa_make_new_image: Done convert for $new_image" } @@ -820,7 +825,12 @@ set client_filename $upload_name } - foreach {base_bytes base_width base_height base_type base_mime base_colors base_quantum base_sha256} [pa_file_info $image_file] {} + if {[catch {set base_info [pa_file_info $image_file]} errMsg]} { + ns_log Warning "Error parsing file data $image_file Error: $errMsg" + continue + } + + foreach {base_bytes base_width base_height base_type base_mime base_colors base_quantum base_sha256} $base_info { break } # If we don't have a mime type we like we try to make a jpg or png # @@ -851,13 +861,13 @@ } # get info again - foreach {base_bytes base_width base_height base_type base_mime base_colors base_quantum base_sha256} [pa_file_info $image_file] {} + foreach {base_bytes base_width base_height base_type base_mime base_colors base_quantum base_sha256} [pa_file_info $image_file] { break } } if {[string equal $base_mime image/jpeg]} { array set exif [pa_get_exif_data ${image_file}] } else { - array set exif {} + array unset exif } set BaseExt [string tolower $base_type] Index: openacs-4/packages/photo-album/www/photos-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photos-add-2.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/photo-album/www/photos-add-2.tcl 12 Jun 2003 06:55:45 -0000 1.2 +++ openacs-4/packages/photo-album/www/photos-add-2.tcl 12 Jun 2003 18:05:05 -0000 1.3 @@ -25,11 +25,11 @@ } directory_exists -requires {directory:notnull} { if {![empty_string_p $directory] && ![file isdirectory $directory]} { - ad_complain "The directory file does not exist" + ad_complain "The directory file does not exist" } } directory_tmp -requires {directory:notnull} { - if {!([ad_conn user_id] == 287 || [ad_conn user_id] == 2601) && ( ![string match "/tmp/pa-tmp" $directory ] || [string match ".." $directory]) } { + if {![empty_string_p $directory] && !([ad_conn user_id] == 287 || [ad_conn user_id] == 2601) && ( ![string match "/tmp/pa-tmp" $directory ] || [string match ".." $directory]) } { ad_complain "You can currently only load images from /tmp/pa-tmp for security" } } @@ -51,11 +51,19 @@ ad_script_abort } +ReturnHeaders text/html +ns_write "Upload Log

Upload Log


\n" + if {![empty_string_p $upload_file]} { + if {[info exists directory] && ![empty_string_p $directory]} { + ns_write "Uploading file only...please submit your directory-based upload separately
" + } + ns_write "starting to load images from file $upload_file
\n" ns_log Debug "made directory $tmp_dir to extract from ${upload_file.tmpfile} ($upload_file)\n" set allfiles [pa_walk $tmp_dir] set remove 1 } else { + ns_write "starting to load images from directory $directory
\n" set allfiles [pa_walk $directory] set remove 0 } @@ -65,7 +73,8 @@ pa_flush_photo_in_album_cache $album_id set page [pa_page_of_photo_in_album [lindex $new_photo_ids 0] $album_id] -ad_returnredirect "album?album_id=$album_id&page=$page" +ns_write "View the images" +ns_write "" # Now that we are done working on the upload we delete the tmp file if [info exists tmp_dir] {