Installing CFX_IMAGE - Florida Memory Project

cortegesmashInternet and Web Development

Nov 10, 2013 (3 years and 11 months ago)

72 views



Page
1

CFX_IMAGE


Introduction

The CFX_IMAGE is a Cold Fusion


custom tag that is designed for image manipulation. The history of this tag started as early as 1997,
as

CFX_GIFGD. The CFX_GIFGD was a single action system


with one call you could only do one thing. I started to develop a scriptable
version for multiple commands and that’s what CFX_IMAGE is all about.




Page
2

Installing CFX_IMAGE

Before one could use any CFX ta
g, it must be installed as CFX custom tag. Depending on the Cold Fusion engine you are running the
installation procedure varies.


Cold Fusion 3.x , 4.0


1.

Start Cold Fusion Administrator (
http://<hostname>/cfide/administrator/index.cfm
)

2.

Choose ‘
Tags
’ or ‘
CFX Tags
’ from the menu


you
’ll see ‘
Registered CFX Tags’
-

heading.

3.

Click ‘
Add’
-
button beneath ‘
Description

-
label ( quite weird position of this button )


4.

Type
CFX_IMAGE

to the ‘
Tag Name

-
textbox

5.

Type
the whole path to the image.dll

e.g
c:
\
cfusion
\
customtags
\
image.dll

6.

Leave ‘ProcessTagRequest’ in the ‘Procedure’

textbox alone


do not alter that setting!

7.

Leave ‘
Keep Library loaded
’ checked.

8.

If you wish, y
ou may write a sort description of this tag e.g. ‘Image manipulation tool’

9.

Press ‘Add’


button

The CFX_IMAGE is now available. Other CFX_IMAGE settings that could be used …..*linkki tähän*



Page
3

Using the tag

The CFX_IMAGE is used inside a CF
ML
-
page. It then an addon to the Cold Fusion and cannot be called or
run independently. The syntax:

<CFX_IMAGE

ACTION=”actionname”

[DEBUG]

[ATTRIBUTE=”value”]

[…ATTRIBUTEn=”value”…]]>

The <CFX_IMAGE


identifies the tag. The CFX
-
prefix tells Cold Fusion to

search for CFX custom tag
from its settings. The

ACTION is a mandatory attribute and attributes following are action based.



Page
4

IPTC markers


The Photoshop Data

Both Associated Press and Adobe (together with CFX_IMAGE and others) support the inclusion of a
dditional data in JFIF Application 13
Marker(s). This marker includes a number of data fields in a format defined by Adobe. We are interested in only two of them


IPTC and
Adobe specific Image URL
-

and Copyright Flag
-
markers.


JFIF APP13
-

Photoshop (and
CFX_IMAGE)

For full details of this APP marker consult the Adobe Photoshop Software Development Kit.

The method used to prepare Adobe APP13 markers is (briefly) as follows:




Form a sequence of Image Resource Blocks (IRBs), as per Photoshop SDK.




Div
ide the sequence as necessary to fir into APP13 markers (Adobe seem to use maximum marker length of about 32000 bytes).
The division can fall anywhere, even in the middle of an IRB.




Wrap each portion of the sequence inside an APP13 marker (with identif
ying text "Photoshop 3.0",).




Since there are no sequence numbering fields, the order of multiple APP13s must be preserved.


CFX_IMAGE outputs repeated IPTC
-
datasets in a comma
-
separated list form (e.g. keywords, supplemental categories ).


IPTC Data St
orage

The IPTC/NAA organisations have defined a format for storing textual, image and editorial information. This specification all
ows for
storage of Records 1 and 2 only. These are the records that describe the textual and editorial information. For a ful
l description see the
document “IPTC/NAA Information Interchange Model”. This is contained in a Photoshop Image Resource with ID 0x0404.The data
contained in this resource is simply a valid IPTC data
-
stream, as sanctioned by the various IPTC specification
documents. The reader is
referred to them for more detailed information on the internal IPTC data structure. Photoshop adds IPTC support for most of r
ecord two.
Photoshop itself does not support all datasets from there (or any from record one) and for comp
atibility reasons nor does CFX_IMAGE.




Page
5

APPLICATION RECORD
-

Record Two

All Record No. 2 datasets are optional, but if any are used dataset 2:00 is mandatory.


#

DATASET NAME

DESCRIPTION

CFX_IMAGE

Photoshop

2:00

Record Version

Mandatory, not repeatable, two
octets.


Full editorial access. Automatic.

Full editorial
access.

2:05

Object Name

Not repeatable,
maximum 64 octets,
consisting of graphic
characters plus spaces.


Used as a shorthand
reference for the object.
Changes to existing data,
such as updated stories
or new crops on photos,
should be identified in
Edit Status.


Examples:

"Wall St."

"Ferry Sinks"

Full editorial access.

IPTC_OBJECT_NAME


Full editorial
access.

2:07

Edit Status

Not repeatable. Maximum 64
octets, consisting of graphic
characters plus

spaces.


Status of the objectdata,
according to the practice of the
provider.


Examples:

"Lead"

"CORRECTION"


Non
-
preservable,does not created, no editorial access.


Unknown, no
editorial
access.

2:10

Urgency

Not repeatable, one octet,
consisting of a numeric
character.


Specifies the editorial urgency
of content and not necessarily
the envelope handling priority
(NAA 1:60, Envelope Priority).
The ’1’

is most urgent, ’5’
normal And ’8’ denotes the
least
-
urgent copy. The
numerals ’9’ and ’0’ are
reserved for future use.

Full editorial access

IPTC_URGENCY

Full editorial
access



Page
6

#

DATASET NAME

DESCRIPTION

CFX_IMAGE

Photoshop

2:15

Category

Not repeatable, maximum three
octets, consisting of alphabetic
characters.


Identifies the subject of the
objectdata in the opinion of the
provider.


A list of categories will be
maintained by a regional
registry, where available,

Otherwise by the provider.


Full editorial access

IPTC_CATEGORY

Full editorial
access

2:20

Supplemental
Category

Repeatable, maximum 32
octets, consisting of graphic
characters plus spaces.


Supplemental categories
further refine the subject of an
objectdata. Only a single
supplemental category may be
contained in each DataSet. A
supple
-
men
tal category may
include any of the recognised
categories as used in 2:15.
Otherwise, selection of
supplemental categories are
left to the provider.


Examples:

"NHL"

"Fußball"


Full editorial access

IPTC_SUPPLEMENTAL_CATEGORY_LIST

Full editorial
access

2:22

Fixture Identifier

Not repeatable, maximum 32
octets, consisting of graphic
characters.


Identifies objectdata that recurs
often and predictably. Enables
users to Immediately find or
recall such an object.


Example:

"EUROWEATHER"


Non
-
preservable, doe
s not create. No editorial access..

preservable,
does not
create. No
editorial
access..

2:25

Keywords

Repeatable, maximum 64
octets, consisting of graphic
characters plus spaces.


Used to indicate specific
information retrieval words.
Each keyword uses a single
Keywords DataSet. Multiple
keywords use multiple
Keywords DataSets.


It is expected that a provider of
various types of data that are
related in subject

matter uses the same
keyword,
enabling the receiving system
or subsystems to search across
all types of data for related
material.


Examples:

"GRAND PRIX"

"AUTO"

Full editorial access

IPTC_KEYWORD_LIST

Full editorial
access



Page
7

#

DATASET NAME

DESCRIPTION

CFX_IMAGE

Photoshop

2:30

Release Date

Not repeatable, eight octets,
cons
isting of numeric
characters.


Designates in the form
CCYYMMDD the earliest date
the provider intends the
objectdata to be used. Follows
ISO 8601 standard.


Example:

"19890317" indicates data for
release on 17 March 1989.



No editorial access.

unknown. No
editorial
access..

2:35

Release Time

Not repeatable, 11 octets,
consisting of graphic
characters.


Designates in the form
HHMMSS±HHMM the earliest
time the provider intends the
objectdata to be used. Follows
ISO 8601 standard.


Example:

"09000
0
-
0500" indicates object
for use after 0900 in New York

(five hours behind UTC)


No editorial access.

unknown. No
editorial
access.

2:40

Special
Instructions

Not repeatable, maximum 256
octets, consisting of graphic
characters plus

spaces.


Other editorial instructions
concerning the use of the
objectdata, such as

embargoes and warnings.


Examples:

"SECOND OF FOUR
STORIES"

"3 Pictures follow"

"Argentina OUT"


Full editorial access

I P T C _ S P E C I A L _ I N S T R U C
T I O N S

Full editorial
access

2:55

Date created

Not repeatable, eight octets,
consisting of numeric
characters.


Represented in the form
CCYYMMDD to designate the
date the intellectual

content of the objectdata was
created rather than the date of
the creation of the physical
representation.

Follows ISO
8601 standard. Where any
portion of the date cannot be
determined, the information will
be represented by “00”

.

Full editorial access

IPTC_DATE_CREATED

Full editorial
access



Page
8

#

DATASET NAME

DESCRIPTION

CFX_IMAGE

Photoshop

2:60

Time created

Not repeatable, 11 octets,
consisting of graphic
characters.


Represented in the form
HHMMSS±HHMM to designate
the time the intellectual content
of the objectdata was created
rather than the creation of the
physical representation.
Follows ISO 8601 standar
d.

Where the time cannot be
precisely determined, the
closest approximation

should be used.


not preserved, does not create. No editorial access..

not
preserved,
does not
create. No
editorial
access..

2:65

Originating

Program

Not repeatable, maximum of 32

octets, consisting of graphic
characters plus spaces.


Identifies the type of program
used to originate the
objectdata.


Examples:

"Word Perfect"

"SCITEX"

"MacDraw"


Not preserved. No editorial access.

unknown. No
editorial
access.

2:70

Program version

Not repeatable, maximum of 10
octets, consisting of graphic
characters plus spaces.


Used to identify the version of
the program mentioned in 2:65.
DataSet 2:70 is invalid if 2:65 is
not present.


Not preserved. No editorial access.

unknown. No
editorial
access.

2:80

By
-
line

Repeatable, maximum 32
octets, consisting of graphic
characters plus spaces.


Contains name of the creator of
the objectdata, e.g. writer,
photographer or

Graphic artist.


Examples:

"Robert Capa"

"Ernest Hemingwa
y"

"Pablo Picasso"


Full editorial access Single

IPTC_BYLINE

Full editorial
access
Single

2:85

By
-
line Title

Repeatable, maximum 32
octets, consisting of graphic
characters plus spaces.


A by
-
line title is the title of the
creator or creators of an
objectdata. Where

used, a by
-
line title should
follow the by
-
line it modifies.


Examples:

"Staff Photographer"

"Corresponsal"

"Envoyé Spécial"


Full editorial access

IPTC_BYLINE_TITLE

Full editorial
access



Page
9

#

DATASET NAME

DESCRIPTION

CFX_IMAGE

Photoshop

2:90

City

Not repeatable, maximum 32
octets, consisting of graphic
characters plus

spaces.


Identifies city of objectdata
origin according to guidelines
established by the Provider.


Examples:

"Zürich"

"Milano"

"New York"


Full edito
rial access

IPTC_CITY

Full editorial
access

2:92

Sublocation

Not repeatable, maximum 32
octets, consisting of graphic
characters plus spaces.


Identifies the location within a
city from which the objectdata
originates,

According to guidelines
established by the provider.


Examples:

"Capitol Hill"

"Maple Leaf Gardens"
"Strandgateparken"


Non
-
preservable, does not create. No editorial access.

preservable,
does not
create. No
editorial
access..

2:95

Province
-
State

Not repeatable, maximum 32
octets, consisting of graphic
characters plus

spaces.


Identifies Province/State of
origin according to guidelines
established by the Provider.


Examples:

"WA"

"Sussex"

"Baden
-
Württemberg"


Full editorial access

IPTC_PROVINCE_STA
TE

Full editorial
access

2:100

Country/Primary
location code

Not repeatable, three octets
consisting of alphabetic
characters.


Indicates the primary l
ocation
where the intellectual property
of the objectdata was created,
e.g. a photo was taken, an
event occurred. Where ISO has
established an appropriate
country code under ISO 3166,
that code will be used. When
ISO3166 does not adequately
provide for ide
ntification of a
location or a new country, e.g.
ships at sea, space, IPTC will
assign an appropriate
three
-
character code under the
provisions of ISO3166 to avoid
conflicts.


Examples:

"USA" (United States)

"FRA" (France)

“XUN” (United Nations)


Non
-
prese
rvable, does not create. No editorial access..

preservable,
does not
create. No
editorial
access..



Page
10

#

DATASET NAME

DESCRIPTION

CFX_IMAGE

Photoshop

2:101

Country Name

Not repeatable, maximum 64
octets, consisting of graphic
characters plus spaces.


Provides full, publishable,
name of the country where the
objectdata was cre
-
ated,
According to guidelines of the
provider.


Full editorial access

IPTC_COUNTRY_NAME

Full editorial
access

2:103

Original
Transmission
Reference

Not repeatable. Maximum 32
oct
ets, consisting of graphic
characters plus spaces.


A code representing the
location of original transmission
according to practices of the
provider.


Examples:

BER
-
5

PAR
-
12
-
11
-
01


Full editorial access

IPTC_ORIGINAL_TRANSMISSION_REFERENCE

Full editorial
access

2:105

Headline

Not repeatable, maximum of
256 octets, consisting of
graphic characters plus spaces.


A publishable entry providing a
synopsis of the contents of the
objectdata.


Example:

"Lindbergh Lands In Paris"


Full editorial acc
ess

IPTC_HEADLINE

Full editorial
access

2:110

Credit

Not repeatable, maximum of 32
octets, consisting of graphic
characters plus spaces.


Identifies the provider of the
objectdata, not necessarily the
owner/creator.


Full editorial access

IPTC_CREDIT

Full editorial
access

2:115

Source

Not repeatable, maximum of 32
octets, consisting of graphic
characters plus spaces.


Identifies the original owner of
the intellectual content of the
objectdata.

This could be an agency, a
member of an agency or an
individual.


Full editorial access

IPTC_SOURCE

Full editorial
access

2:116

Copyright Notice

Not repeatable, maximum of
128 octets, consisting of
graphic characters plus

spaces.


Contains any necessary
c
opyright notice


Full editorial access? Along with Adobe Copyright Flag

IPTC_COPYRIGHT_NOTICE

ADOBE_COPYRIGHT_FLAG

Full editorial
access?
Along with
Adobe
Copyright
Flag

2:118

Contact

Repeatable, maximum of 128
octets, consisting of graphic
characters plus

spaces.


Identifies the person or
organisation which can provide
further background

information on the objectdata.


Non
-
preservable, does not create. No editorial access..

preservable
,
does not
create. No
editorial
access..



Page
11

#

DATASET NAME

DESCRIPTION

CFX_IMAGE

Photoshop

2:120

Caption/Abstract

Not repeatable, maximum of
2000 octets, consisting of
graphic characters plus
Carriage
-
returns, linefeeds and
spaces.


A textual description of the
objectdata, particularly used
where the object is not text.


Full editorial access

IPTC_CAPTION

Full editorial
access

2:122

Writer/Editor

Repeatable, maximum 32
octets, consisting of graphic
characters plus spaces.


Identifica
tion of the name of the
person involved in the writing,
editing or correcting of the
objectdata or caption.


Full editorial access

IPTC_WRITER

Full editorial
access





Page
12

CFX_IMAGE Parameters

CFX_IMAGE has four different ways to apply IPTC
-
information to an image.

1.

Registry

2.

CFX_IMAGE parameters

3.

IML
-
commands

4.

PASTE_IPTC
-
action + CFX_IMAGE parameters

The current version of CFX_IMAGE
does

provide lossless storage method for applying IPTC.
CFX_IMAGE only writes those IPTC datasets that have a value set.

BY DEFAULT THE CFX_IMAGE DOES PRESERVE/WRITE IPTC MARKERS!

You have to pass an extra parameter to the call:

IPTC=”YES/NO/TRUE/FALSE”

Example:

<CFX_IMAGE IPTC=”NO” …>

to disallow IPTC information to be written though they are read. This is for the nature of the tags normal usage
(image manipulation on a fly) and the need of smaller images. The IPTC can also be set in the registry (as be
low
explained).

Also if you explicitely set all the string values to “” and adobe_copyright_flag to “0”, your IPTC information
does not get to be written.

Registry

In the CFX_IMAGE registry HIVE:

HKEY_LOCAL_MACHINE

\
SOFTWARE

\
Allaire

\
ColdFusion

\
CurrentVe
rsion

\
CustomTags

\
CFX_Image

You can preset the most common IPTC settings such as IPTC_COUNTRY_NAME, IPTC_CITY etc.
These values always override any CFX_IMAGE attribute or IML command.
The registry values are
string

values and they are to be named as thei
r CFX_IMAGE output equivalence.



Page
13

Example:

REGEDIT4

[HKEY_LOCAL_MACHINE
\
SOFTWARE
\
Allaire
\
ColdFusion
\
CurrentVersion
\
CustomTags
\
CFX_Image]

"LibraryPath"="C:
\
\
Cfusion
\
Customtags
\
\
Image.dll"

"ProcedureName"="ProcessTagRequest"

"Description"="Cold Fusion image
manipulation tool"

"CacheLibrary"="1"

"IPTC_WRITER"="Jukka Manner"

"IPTC_COUNTRY_NAME"="Finland"

“IPTC_CITY”=”Helsinki”


Due to the overriding nature of these settings, it is adviceable not to use registry values for non
-
constant
IPTC
-
datasets (e.g. By
-
Li
ne, Headline, Date Created etc ).


CFX_IMAGE attributes

The CFX_IMAGE attributes are passed along with the call of the tag.
These settings override any
IML
-
commands
. The attribute values are named as their CFX_IMAGE output equivalence.

Example:

<CFX_IMAGE
ACTION=”IML” FILE=”#ExpandPath(‘myimage.jpg’)#”

IPTC_SOURCE=”S
-
Inet Team”

IPTC_COPYRIGHT_NOTICE=”Jukka Manner”

ADOBE_COPYRIGHT_FLAG=”1”

COMMANDS=”

write #ExpandPath(‘myimage_iptc.jpg’)#”>



Page
14

IML
-
Commands

The IML
-
action allows one to write IPTC datasets thru
the IML parser.
IML
-
commands are named

Set_<iptc_output name>

Example:

<CFX_IMAGE ACTION=”IML” FILE=”#ExpandPath(‘myimage.jpg’)#”

COMMANDS=”

set_iptc_writer Jukka Manner

set_iptc_source S
-
Inet team

set_iptc_date_created #Now()#

write #ExpandPath(‘myimage_i
ptc.jpg’)#”>

IML


Command explanations


Command

CFX_IMAGE output

Datatype and example

set_iptc_object_name

IPTC_OBJECT_NAME

String.

“Phonebook picture”

set_iptc_urgency

IPTC_URGENCY

String


range “0”


“8”

set_iptc_category

IPTC_CATEGORY

String.

“210”

set_iptc_supplemental_category_list

IPTC_SUPPLEMENTAL_CATEGORY_LIST

A comma
-
separated stringlist

“Face,Outside”

set_iptc_keyword_list

IPTC_KEYWORD_LIST

A comma
-
separated stringlist

“phonebook,face,outdoors,official”

set_iptc_special_instructions

IPTC_SPECIAL_INSTRUCTIONS

String

“do not delete”

set_iptc_date_created

IPTC_DATE_CREATED

Date format (ODBC Date, ODBC
timestamp, yyyy
-
mm
-
dd)

“1999
-
05
-
14”

set_iptc_byline

IPTC_BYLINE

String

“Jukka Manner”

set_iptc_byline_title

IPTC_BYLINE_TITLE

String


Snapshot”

set_iptc_city

IPTC_CITY

String

“Helsinki”

set_iptc_province_state

IPTC_PROVINCE_STATE

String

“NJ”



Page
15

Command

CFX_IMAGE output

Datatype and example

set_iptc_country_name

IPTC_COUNTRY_NAME

String

“Finland”

set_iptc_original_transmission_reference

IPTC_ORIGINAL_TRANSMISSION_REFERENCE

String


123A”

set_iptc_headline

IPTC_HEADLINE

String

“Official photo of Jukka Manner”

set_iptc_credit

IPTC_CREDIT

String

“Allaire Corp”

set_iptc_source

IPTC_SOURCE

String

“CFX_IMAGE”

set_iptc_copyright_notice

IPTC_COPYRIGHT_NOTICE

String


Copyright by J. Manner”

set_iptc_caption

IPTC_CAPTION

String

“This can contain linefeeds
\
nEach
linefeed is to be marked as ‘
\
n’”

set_iptc_writer

IPTC_WRITER

String

“Jukka Manner”

set_adobe_copyright_flag

ADOBE_COPYRIGHT_FLAG

String


“0” / “1”

“1”

set_adobe_image_url

ADOBE_IMAGE_URL

String

“http://www.capgemini.fi”




Page
16

PASTE_IPTC

action


Unlike the IML
-
action, this action allows one to paste IPTC datasets to existing JPEG images w
ithout
re
-
writing the JPEG image information. Each time JPEG is decompressed and compressed back it looses
information thus deterioring the image quality. This paste method read the image binary and writes only IPTC
specific information to the image and le
aves the image data and other setting untouched. The CFX_IMAGE is
actually one of the very few applications that can do this.

The IPTC
-
parameters are passed along with the call as explained earlier. All rules about the registry use apply.
All non
-
passed IP
TC datasets are preserved.

Non
-
IPTC Parameters :

FILE


the source file to be used ( Required )

OUTPUT

-

the output file to be used ( Optional )

If you don’t use OUTPUT
-
attribute with the call or if you set the output to be same as the FILE, the
CFX_IMAGE

will use a runtime temporary file to hold the image data before flushing the image information
to the OUTPUT.

The CFX_IMAGE exposes all the CFML
-
variables from the written file ( IMG_SIZE, IMG_TYPE etc ) and
all the IPTC
-
variables.

Example:

Examples:

1. T
his will write only the IPTC_SOURCE (2:115) to the image


rest of the


IPTC information will be preserved.

<CFX_IMAGE ACTION=”PASTE_IPTC” FILE=”#ExpandPath(‘myimage.jpg’)#”

IPTC_SOURCE=”Cold Fusion CFX Custom Tag”>

2. This will output a new image rather

that altering the original:

<CFX_IMAGE ACTION=”PASTE_IPTC”

FILE=”#ExpandPath(‘myimage.jpg’)#”

OUTPUT=”#ExpandPath(‘myimage_iptc.jpg’)#”

IPTC_SOURCE=”Cold Fusion CFX Custom Tag”>


The JPEG image can also hold a specia
l marker for comments. The CFX_IMAGE action PASTE_IPTC
accepts also a COMMENT
-
attribute, which allows one to write a comment to the image. You may clear the
comment marker by

COMMENT=”NO COMMENT”

And preserve the what
-
ever
-
comment the image holds by:

COMM
ENT=”PRESERVE”

If you like to save your own comment, just write the comment as a string:

COMMENT=”your comment text ….”