Şu sürüme ilişkin yardım içeriğini görüntülüyorsunuz:

ImageMagick is a software plugin to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and curves.

You can use ImageMagick features from the Adobe Experience Manager (AEM) command-line based media handler to process images.

Installing ImageMagick

Multiple versions of ImageMagic binaries are available for various operating systems. Depending upon on your, download the appropriate version of the installation files and install them on your local system.

  1. Download the appropriate ImageMagick installation files for your operating system.

  2. Run the downloaded installation file to install ImageMagick on the disk hosting the AEM server.

  3. Test the installation.

Set Up the Command Line Process Step

The following example shows you how to set up the command line process step so that every time an asset with the mime-type gif or tiff is added to /content/dam on the AEM server, a flipped image of the original is created together with three additional thumbnails (140x100, 48x48 and 10x250).

  1. Set up the command-line tool so you can run the convert command from the command line.

  2. To see if the tool is installed properly, run the following command convert -h on the command line.

    It displays a help screen with all the possible options of the convert tool.

    Not:

     In some versions of Windows (for example Windows SE), the convert command may fail to run because it conflicts with the native convert utility that is part of Windows installation. In this case, mention the complete path for the ImageMagick utility used to convert image files to thumbnails. For example, "C:\Program Files\ImageMagick-6.8.9-Q16\convert.exe" -define jpeg:size=319x319 ${filename} -thumbnail 319x319 cq5dam.thumbnail.319.319.png.

  3. To see if the tool runs properly, add a .jpg image to the working directory and run the command convert <image-name>.jpg -flip <image-name>-flipped.jpg on the command line.
    A flipped image is added to the directory.

  4. Go to the Workflow console.

  5. In the Models tab, edit the DAM Update Asset model.

  6. Change the settings of the Web enabled rendition step as follows:

    Arguments:

    mime:image/gif,mime:image/tiff,tn:140:100,tn:48:48,tn:10:250,cmd:convert ${directory}/${filename} -flip ${directory}/${basename}.flipped.jpg

  7. Save the workflow.

Testing the Workflow

Finally, test the modified workflow by adding a new asset to /content/dam:

  1. In the file system, get a .tiff image of your choice. Rename it to myImage.tiff and copy it to /content/dam, for example by using WebDAV.

  2. Go to the AEM Assets console, for example http://localhost:4502/libs/wcm/core/content/damadmin.html.

  3. Open the asset myImage.tiff and verify that the flipped image and the three thumbnails have been created.

Configuring the CommandLineProcess Process Step

This section describes how to set the Process Arguments of the CommandLineProcess.

The values of the Process Arguments must be separated by a comma and must not start with a whitespace.

 Argument-Format Description
 mime:<mime-type>

Optional argument. The process is applied if the asset has the same mime-type as the one of the argument.

Several mime-types can be defined.

 tn:<width>:<heigth>

Optional argument. The process creates a thumbnail with the dimensions defined in the argument.

Several thumbnails can be defined.

 cmd: <command>

Defines the command that will be executed. The syntax depends on the command line tool.

Only one command can be defined.

The following variables can be used to create the command:

${filename}: name of the input file, e.g. original.jpg
${file}: full path name of the input file, e.g. /tmp/cqdam0816.tmp/original.jpg
${directory}: directory of the input file, e.g. /tmp/cqdam0816.tmp.
${basename}: name of the input file without its extension, e.g. original
${extension}: extension of the input file, e.g. jpg

For example, if ImageMagick is installed on the disk hosting the AEM server and if you create a process step using CommandLineProcess as Implementation and the following values as Process Arguments:

mime:image/gif,mime:image/tiff,tn:140:100,tn:48:48,tn:10:250,cmd:convert ${directory}/${filename} -flip ${directory}/${basename}.flipped.jpg

then, when the workflow runs, the step only applies to assets that have image/gif or mime:image/tiff as mime-types, it creates a flipped image of the original, converts it into .jpg and creates three thumbnails that have the dimensions: 140x100, 48x48 and 10x250.

Use the following Process Arguments to create the three standard thumbnails using ImageMagick:

mime:image/tiff,mime:image/png,mime:image/bmp,mime:image/gif,mime:image/jpeg,cmd:convert ${filename}  -define jpeg:size=319x319 -thumbnail "319x319>" -background transparent -gravity center -extent 319x319 -write png:cq5dam.thumbnail.319.319.png -thumbnail "140x100>" -background transparent -gravity center -extent 140x100 -write cq5dam.thumbnail.140.100.png  -thumbnail "48x48>" -background transparent -gravity center -extent 48x48 cq5dam.thumbnail.48.48.png

Use the following Process Arguments to create the web-enabled rendition using ImageMagick:

mime:image/tiff,mime:image/png,mime:image/bmp,mime:image/gif,mime:image/jpeg,cmd:convert ${filename} -define jpeg:size=1280x1280 -thumbnail "1280x1280>" cq5dam.web.1280.1280.jpeg

Not:

The CommandLineProcess step only applies to Assets (nodes of type dam:Asset) or descendants of an Asset.

Mitigating Security Vulnerabilities

There are multiple vulnerabilities associated with using ImageMagick to process images. For example, processing user submitted images involves the risk of remote code execution (RCE).

In addition, a number of image processing plugins depend on the ImageMagick library, including, but not limited to, PHP’s imagick, Ruby’s rmagick and paperclip, and nodejs’s imagemagick.

If you use ImageMagick or an affected library, Adobe recommend that you mitigate the known vulnerabilities by doing at least one of the following (but preferably both):

  1. Verify that all image files begin with the expected "magic bytes" corresponding to the image file types you support before sending them to ImageMagick for processing.

  2. Use a policy file to disable the vulnerable ImageMagick coders. The global policy for ImageMagick is usually found in “/etc/ImageMagick”. 

Bu çalışma Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License kapsamında lisanslanmıştır  Creative Commons şartları, Twitter™ ve Facebook sitelerinde paylaşılanları kapsamaz.

Yasal Uyarılar   |   Çevrimiçi Gizlilik İlkesi