| |
341 |
341 |
I Use ImageMagick instead of aolserver function because it can handle more than |
| |
342 |
342 |
just gifs and jpegs. |
| |
343 |
343 |
} { |
| |
344 |
344 |
set identify_string [exec [parameter::get -parameter ImageMagickPath]/identify $filename] |
| |
345 |
345 |
regexp {[ ]+([0-9]+)[x]([0-9]+)[\+]*} $identify_string x width height |
| |
346 |
346 |
uplevel "set $width_var $width" |
| |
347 |
347 |
uplevel "set $height_var $height" |
| |
348 |
348 |
} |
| |
349 |
349 |
|
| |
350 |
350 |
ad_proc -public pa_make_new_image { |
| |
351 |
351 |
base_image |
| |
352 |
352 |
new_image |
| |
353 |
353 |
geometry |
| |
354 |
354 |
} { |
| |
355 |
355 |
Uses ImageMagick program to create a file named new_image from base_image that |
| |
356 |
356 |
fits within a box defined by geometry. If geometry is just a number it will |
| |
357 |
357 |
be used for both width and height. |
| |
358 |
358 |
|
| |
359 |
359 |
ImageMagick will retain the aspect ratio of the base_image when creating the new_image |
| |
360 |
360 |
|
| |
361 |
|
jhead -dt is called to delete any embeded thumbnail since digital camera thumbnails |
| |
|
361 |
jhead -dt is called to delete any embedded thumbnail since digital camera thumbnails |
| |
362 |
362 |
can be quite large and imagemagick does not remove them when converting (so thumbnails |
| |
363 |
|
can end up being 8k for the thumbnail + 32k for the embeded thumbnail). |
| |
|
363 |
can end up being 8k for the thumbnail + 32k for the embedded thumbnail). |
| |
364 |
364 |
|
| |
365 |
365 |
@param base_image original image filename |
| |
366 |
366 |
@param new_image new image filename |
| |
367 |
367 |
@param geometry string as passed to convert |
| |
368 |
368 |
|
| |
369 |
369 |
} { |
| |
370 |
370 |
# If we get an old style single number |
| |
371 |
371 |
if {[regexp {^[0-9]+$} $geometry]} { |
| |
372 |
372 |
set geometry ${geometry}x${geometry} |
| |
373 |
373 |
} |
| |
374 |
374 |
ns_log debug "pa_make_new_image: Start convert, making $new_image geometry $geometry" |
| |
375 |
375 |
exec [parameter::get -parameter ImageMagickPath]/convert -geometry $geometry -interlace None -sharpen 1x2 $base_image $new_image |
| |
376 |
376 |
if {[catch {exec jhead -dt $new_image} errmsg]} { |
| |
377 |
377 |
ns_log Warning "pa_make_new_image: jhead failed with error - $errmsg" |
| |
378 |
378 |
} |
| |
379 |
379 |
ns_log debug "pa_make_new_image: Done convert for $new_image" |
| |
380 |
380 |
} |
| |
381 |
381 |
|
| |
382 |
382 |
# wtem@olywa.net, 2001-09-22 |
| |
383 |
383 |
# replaced pa_delete_scheduled_files with standard cr_delete_scheduled_files |