image::resize (public)

 image::resize [ -item_id item_id ] [ -revision_id revision_id ] \
    [ -size_name size_name ]

Defined in packages/acs-content-repository/tcl/image-procs.tcl

Create a thumbnail of an image in the content repository

Switches:
-item_id (optional)
item_id of image
-revision_id (optional)
-size_name (optional, defaults to "thumbnail")
Returns:
image item_id of the thumbnail
Author:
Dave Bauer <dave@solutiongrove.com>
Created:
2006-08-27

Partial Call Graph (max 5 caller/called nodes):
%3 image::resize_existing_images image::resize_existing_images (private) image::resize image::resize image::resize_existing_images->image::resize packages/acs-templating/www/scripts/xinha/attach-image.tcl packages/acs-templating/ www/scripts/xinha/attach-image.tcl packages/acs-templating/www/scripts/xinha/attach-image.tcl->image::resize ad_tmpdir ad_tmpdir (public) image::resize->ad_tmpdir ad_tmpnam ad_tmpnam (public) image::resize->ad_tmpnam content::item::get_best_revision content::item::get_best_revision (public) image::resize->content::item::get_best_revision content::revision::get_cr_file_path content::revision::get_cr_file_path (public) image::resize->content::revision::get_cr_file_path content::revision::new content::revision::new (public) image::resize->content::revision::new

Testcases:
No testcase defined.
Source code:
    if {$revision_id eq ""} {
        set revision_id [content::item::get_best_revision -item_id $item_id]
    }
    set original_filename [content::revision::get_cr_file_path -revision_id $revision_id]
    set tmp_filename [ad_tmpnam "[ad_tmpdir]/XXXXXX"]
    array set sizes [image::get_convert_to_sizes]

    if {[catch {exec [image::convert_binary] -resize $sizes($size_name) $original_filename $tmp_filename} errmsg]} {
        # maybe imagemagick isn't installed?
        file delete -- $tmp_filename
        return ""
    }
    if {[set resize_item_id  [image::get_size_item_id  -item_id $item_id  -size_name $size_name]] eq ""} {

        set resize_item_id  [image::new  -item_id $resize_item_id  -name "${item_id}_${size_name}"  -parent_id $item_id  -relation_tag "image-${size_name}"  -tmp_filename $tmp_filename]
    } else {
        content::revision::new  -item_id $resize_item_id  -tmp_filename $tmp_filename
    }
    file delete -- $tmp_filename
    return $resize_item_id
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-content-repository/tcl/image-procs.xql

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