質問

I am using coldfusion's imageGetIPTCMetadata() function to get the iptc keywords.

I used Photomechanics to insert some keywords in a hierarchical fashion like this

Personnel   |   Appointments   |   Assistant Chief of General Staff (ACGS), Personnel  |  Ranks  |  Royal Marine  |  Colour Sergeant (CSgt), Personnel | Ranks | Royal Navy | Chief Petty Officer (CPO), Personnel|Ranks|Army|Field Marshall (Fd Marshall) (FM)

But after I call the method in my CFC I get this -

How can I get the keywords with a delimeter or something so that I can reuse them in my code.

enter image description here

役に立ちましたか?

解決 3

I found the solution here:

<cfparam name="URL.source" default="xmp-asset.jpg">
<cffile action="readbinary" file="#ExpandPath(URL.source)#" variable="data">
<!-- encode the binary data to hex -->
<cfset hex_data = BinaryEncode(data,"hex") />
<!-- string indicating beginning of packet '<x:xmpmeta' -->
<cfset xmp_string_begin = "3C783A786D706D657461" />
<!-- string indicating end of packet '</x:xmpmeta>' -->
<cfset xmp_string_end = "3C2F783A786D706D6574613E" />
<!-- find the starting index in the hex string -->
<cfset idx_start = FindNoCase(xmp_string_begin,hex_data) />
<!-- find the ending index in the hex string -->
<cfset idx_end = FindNoCase(xmp_string_end,hex_data,idx_start) + Len(xmp_string_end) />
<!-- using the start and end indices, extract the xmp packet -->
<cfset xmp_hex = Mid(hex_data,idx_start,Evaluate(idx_end-idx_start)) />
<!-- convert the hex to readable characters -->
<cfset xmp_string = ToString(BinaryDecode(xmp_hex,"hex")) />
<!-- parse the xml string to and xml structure -->
<cfset xmp_xml = XmlParse(xmp_string) />
<cfcontent type="text/xml">
<cfoutput>#xmp_string#</cfoutput>

Now I can get the entire XMP xml and do all I want to do with the data there.

他のヒント

If I understand your question correctly, you can use one of the List functions like ListGetAt to get the keywords with a delimiter. Or if you prefer working with arrays you can use the ListToArray function keywordsArray = ListToArray(data.Keywords,"|")

<cfscript>  
    data = ImageGetIPTCMetadata(myImage);

    for( i=1; i LTE ListLen(data.Keywords,"|"); i++ )
    {
        WriteOutput( Trim( ListGetAt(data.Keywords, i, "|") ) & "<br />" );
    }
</cfscript>

I use CFX_OpenImage to read and write IPTC_ data in .jpg files in CF8 thru CF11. I also use this for image resize and rotation.

More CFX_OPENIMAGE INFO go to http://www.kolumbus.fi/jukka.manner/cfx_openimage/

It GraphicsMagick 1.3.17.
GraphicsMagick (www.graphicsmagick.org) maintains a stable release branch, maintains a detailed Change Log, and maintains a stable source repository with complete version history so that changes are controlled, and changes between releases are accurately described. GraphicsMagick provides continued support for a release branch.
More INSTALLATION INFO:

Note: If you are installing 64bit version of the tag, please download and install Microsoft Visual C++ 2010 Redistributable Package (x64) from Microsoft (http://www.microsoft.com/download/en/details.aspx?id=14632). The x64 version has been compiled and written in Visual Studio 2010.
CFX_OPENIMAGE installation steps common to both versions:
Create an environment variable Since GraphicsMagick needs read configuration files (*.mgk files), we need to tell the tag where those files are located. In order to do that, a system or cold fusion runtime user specific environment variable must be set. The name of this variable is CFX_OPENIMAGE_FULLPATH.
CFX_OPENIMAGE_FULLPATH environment variable should contain full pathname which points to a directory where all mgk-files and cfx_openimage.ini file are kept. A default value for this is “c:\cfx_openimage\”. Notice that the last “\” character is needed too.
You may install the actual dll where ever you like, it’s up to you to register is anyway via CF admin page. For keeping the security settings for all the files equal, it is recommended to keep cfx_openimage.dll in the same directory that the *.mgk and cfx_openimage.ini directory.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top