pa_make_new_image (public)

 pa_make_new_image base_image new_image geometry

Defined in packages/photo-album/tcl/photo-album-procs.tcl

Uses ImageMagick program to create a file named new_image from base_image that fits within a box defined by geometry. If geometry is just a number it will 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 embedded 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 embedded thumbnail).

Parameters:
base_image (required)
original image filename
new_image (required)
new image filename
geometry (required)
string as passed to convert

Partial Call Graph (max 5 caller/called nodes):
%3 pa_load_images pa_load_images (public) pa_make_new_image pa_make_new_image pa_load_images->pa_make_new_image parameter::get parameter::get (public) pa_make_new_image->parameter::get

Testcases:
No testcase defined.
Source code:
    # If we get an old style single number
    if {[regexp {^[0-9]+$} $geometry]} { 
        set geometry ${geometry}x${geometry}
    }
    ns_log debug "pa_make_new_image: Start convert, making $new_image geometry $geometry"
    exec [parameter::get -parameter ImageMagickPath]/convert -geometry $geometry -interlace None -sharpen 1x2 $base_image $new_image
    if {[catch {exec jhead -dt $new_image} errmsg]} { 
        ns_log Warning "pa_make_new_image: jhead failed with error - $errmsg"
    }
    ns_log debug "pa_make_new_image: Done convert for $new_image"
Generic XQL file:
packages/photo-album/tcl/photo-album-procs.xql

PostgreSQL XQL file:
packages/photo-album/tcl/photo-album-procs-postgresql.xql

Oracle XQL file:
packages/photo-album/tcl/photo-album-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: