03-25-2011 07:18 AM
package com.easypress.alfresco.repo.content.transform.magick;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import org.alfresco.util.exec.RuntimeExec.InputStreamReaderThread;
public class ImageMagickContentTransformerWorkerTest {
private static final String IMG_ROOT = "c:/ImageMagick-6.6.7-Q16";
private static final String IMG_DYN = IMG_ROOT;
private static final String IMG_EXE = IMG_ROOT + "/imconvert";
public static void main(String[] args) {
String[] commandToExecute = new String[] {
IMG_EXE,
"c:/temp/ImageMagickContentTransformerWorker_source_test.jpg[0]",
"-thumbnail",
"50%",
"c:/temp/ImageMagickContentTransformerWorker_output_test.jpg"};
String[] processProperties = new String[] {
"MAGICK_HOME=" + IMG_ROOT,
"DYLD_LIBRARY_PATH=" + IMG_DYN,
"LD_LIBRARY_PATH=" + IMG_DYN};
File processDirectory = null;
// Any ONE of these will solve the problem
// String[] processProperties = null;
// String[] processProperties = new String[] { "PATH=" + IMG_ROOT};
// File processDirectory = new File(IMG_ROOT);
try {
Process process = Runtime.getRuntime().exec(commandToExecute, processProperties, processDirectory);
InputStreamReaderThread stdOutGobbler = new InputStreamReaderThread(process.getInputStream(), Charset.defaultCharset());
InputStreamReaderThread stdErrGobbler = new InputStreamReaderThread(process.getErrorStream(), Charset.defaultCharset());
stdOutGobbler.start();
stdErrGobbler.start();
try {
process.waitFor();
} catch (InterruptedException e) {
stdErrGobbler.addToBuffer(e.toString());
}
stdOutGobbler.waitForCompletion();
stdErrGobbler.waitForCompletion();
System.out.println("out: " + stdOutGobbler.getBuffer());
System.out.println("err: " + stdErrGobbler.getBuffer());
} catch (IOException e) {}
}
}
04-04-2011 07:37 AM
07-13-2011 04:34 AM
01-09-2012 10:20 AM
I have solved this problem by installing ImageMagick version with static libraries.Indeed, this fixed my problem too!
convert C:\temp\test.jpg -resize 120 C:\temp\test_b.jpg3. specify the path + exe to your ImageMagick-installation in alfresco-global.propertiesimg.root=<YourImageMagickInstallationDirectory>
img.exe=${img.root}/convertand restart Alfresco.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.