• Publicity: Public Only All

image-procs.tcl

Procedures to handle image subtype Image magick handling procedures inspired and borrowed from photo-album and imagemagick packages

Location:
packages/acs-content-repository/tcl/image-procs.tcl
Created:
2006-07-31
Author:
Dave Bauer <dave@thedesignexperience.org>
CVS Identification:
$Id: image-procs.tcl,v 1.18.2.7 2024/02/25 10:40:35 gustafn Exp $

Procedures in this file

Detailed information

image::convert_binary (public)

 image::convert_binary

Find imagemagick convert binary

Author:
Dave Bauer <dave@solutiongrove.com>
Created:
2006-08-27

Testcases:
acs_tcl_exec_required_dependencies, acs_tcl_exec_optional_dependencies

image::filename_mime_type (public)

 image::filename_mime_type [ -filename filename ] \
    [ -mime_type mime_type ]

Use ns_guesstype if we don't know the mime_type

Switches:
-filename (optional)
Filename of image file
-mime_type (optional)
If known, the mime type of the file
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2006-08-27

Testcases:
No testcase defined.

image::get_file_dimensions (public)

 image::get_file_dimensions [ -filename filename ] \
    [ -mime_type mime_type ]

Get the width and height of an image from a file in the filesystem. This tries first to use built-in ns_*-support, and if not available, if talls back to imagemagick. We use imagemagick first since it supports many more image formats.

Switches:
-filename (optional)
full path to file in the filesystem
-mime_type (optional)
Returns:
Returns a list of width and height
Author:
Dave Bauer <dave@solutiongrove.com>
Created:
2006-08-28

Testcases:
No testcase defined.

image::get_file_info (public)

 image::get_file_info [ -filename filename ]

Get info about an image file, dimensions, mime_type The name of this proc tries to make clear that we aren't getting info for an image type object, but examinging an image file in the filesystem

Switches:
-filename (optional)
Full path to file in the filesystem
Returns:
List of width, height, and mime_type

Testcases:
No testcase defined.

image::get_file_info_array (public)

 image::get_file_info_array [ -filename filename ] \
    [ -array_name array_name ]

Get info about an image file, dimensions, mime_type into an array in the caller's namespace.

Switches:
-filename (optional)
Full path to file in the filesystem
-array_name (optional)
Array in caller's namespace to populate
Returns:
List of width height mime_type in array get format
Author:
Dave Bauer
Created:
2006-08-27
See Also:

Testcases:
No testcase defined.

image::get_info (public)

 image::get_info -filename filename -array array

Get the width and height of an image file. The width and height are returned as 'height' and 'width' entries in the array named in the parameter. Uses ImageMagick instead of AOLserver function because it can handle more than just gifs and jpegs. The plan is to add the ability to get more details later. This proc duplicates and seems somehow superseded by image::imagemagick_identify, it might be a good idea to deprecate it in the future. One important difference is this proc won't fail in case of error.

Switches:
-filename (required)
Name of the image file in the filesystem.
-array (required)
Name of an array where you want the information returned.
See Also:

Testcases:
No testcase defined.

image::get_resized_item_id (public)

 image::get_resized_item_id [ -item_id item_id ] \
    [ -size_name size_name ]

Get the item id of a related resized image, usually the thumbnail size

Switches:
-item_id (optional)
Item_id of the original image
-size_name (optional, defaults to "thumbnail")
Returns:
item_id of the resized image, empty string if it doeesn't exist
Author:
Dave Bauer <dave@solutiongrove.com>
Created:
2006-08-29

Testcases:
No testcase defined.

image::identify_binary (public)

 image::identify_binary

Find imagemagick identify binary

Author:
Dave Bauer <dave@solutiongrove.com>
Created:
2006-08-27

Testcases:
acs_tcl_exec_required_dependencies, acs_tcl_exec_optional_dependencies

image::imagemagick_file_dimensions (public)

 image::imagemagick_file_dimensions [ -filename filename ]

Get the dimensions of an image from imagemagick

Switches:
-filename (optional)
Full path to an image file in the filesystem
Author:
Dave Bauer <dave@solutiongrove.com>
Created:
2006-08-27

Testcases:
No testcase defined.

image::imagemagick_identify (public)

 image::imagemagick_identify [ -filename filename ]

Get width height and mime type from imagemagick

Switches:
-filename (optional)
Full path to an image file in the filesystem
Returns:
List of width height mime_type
Author:
Dave Bauer <dave@solutiongrove.com>
Created:
2006-08-27

Testcases:
No testcase defined.

image::mime_type (public)

 image::mime_type [ -filename filename ]

Use ns-built-in mimetype or image magick if not available

Switches:
-filename (optional)
Filename of image file

Testcases:
No testcase defined.

image::new (public)

 image::new [ -name name ] [ -parent_id parent_id ] \
    [ -item_id item_id ] [ -locale locale ] \
    [ -creation_date creation_date ] [ -creation_user creation_user ] \
    [ -context_id context_id ] [ -package_id package_id ] \
    [ -creation_ip creation_ip ] [ -item_subtype item_subtype ] \
    [ -content_type content_type ] [ -title title ] \
    [ -description description ] [ -mime_type mime_type ] \
    [ -relation_tag relation_tag ] [ -is_live is_live ] \
    [ -storage_type storage_type ] [ -attributes attributes ] \
    [ -tmp_filename tmp_filename ] [ -width width ] [ -height height ]

Create a new image object from a temporary file

Switches:
-name (optional)
Name of image item, must be unique per parent_id
-parent_id (optional)
Parent object for this image. Context_id will be set to parent_id
-item_id (optional)
Item id of the content item for this image. The item_id will be generated from the acs_object_id sequence if not specified.
-locale (optional)
-creation_date (optional)
-creation_user (optional)
-context_id (optional)
-package_id (optional)
-creation_ip (optional)
-item_subtype (optional, defaults to "content_item")
-content_type (optional, defaults to "image")
-title (optional)
-description (optional)
-mime_type (optional)
-relation_tag (optional)
-is_live (optional)
-storage_type (optional, defaults to "file")
-attributes (optional)
-tmp_filename (optional)
Filename in the filesystem, readable by AOLserver user to create image from
-width (optional)
-height (optional)
Returns:
Item_id
Error:
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2006-07-31

Testcases:
image_new

image::ns_size (public)

 image::ns_size [ -filename filename ] [ -mime_type mime_type ]

Use ns_gifsize/ns_jpegsize to try to get the size of an image

Switches:
-filename (optional)
Full path to file in the filesystem
-mime_type (optional)
Returns:
List containing width and height

Testcases:
No testcase defined.

image::resize (public)

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

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

Testcases:
No testcase defined.
[ show source ]