: I는 GM 복합체를 이용하여 다른 화상의 상부에 하나 개의 영상을 이용하여 워터 마크를 만들려고ImageMagick과/GraphicsMagick PHP 여러 이진 데이터
gm convert gif:- jpg:-
:
gm composite -geometry +0+0 orig.jpg watermark.jpg new.jpg
하지만, 내 PHP 코드에서, 나는 모두가 각각 orig.jpg 및 watermark.jpg의 이진 데이터이며, 두 개의 문자열, $의 orig_str 및 $ watermark_str 있습니다. 위의 두 문자열을 stdin으로 전달하여 위를 실행하려고하지만 그렇게 할 방법을 찾을 수 없습니다.
$ orig_str을 수정하는 것이 좋습니다.
나는 건축 학적 이유로 PHP의 GM 플러그인을 사용하지 않고 GM을 실행 중이다. 대신, gm을 실행하려면 다음과 같이하십시오.
$img = "binary_data_here";
$cmd = ' gm convert gif:- jpg:-';
$stdout = execute_stdin($cmd, $img);
function execute_stdin($cmd, $stdin /* $arg1, $arg2 */) {...}
누구나 표준 입력에서 둘 이상의 입력을 수행하는 방법을 알고 있습니까?
흠 ... 어떻게 파일 GraphicsMagick으로 처리 사용합니까? GM은 파일 핸들러가 아니라 파일 이름을 사용하는 것으로 보입니다. – porkeypop
흠. 질문은 "외부 프로세스를 시작하고 데이터를 표준으로 가져 오는 방법"이라고 생각했습니다. 실제로 "이미지 데이터를 GraphicsMagick에 stdin을 통해 어떻게 공급합니까?" 이 경우 실제로 위의 코드가 실제로 프로그램을 제대로 호출하지 않는다고 가정 할 때 실제로는 알 수 없습니다. 이제는 더 많이 생각해 보았습니다. stdin을 통해 * 두 개의 파일을 어떻게 공급할 계획입니까? 어쩌면 두 개의 파일을 대신 디스크에 써야할까요? ['tempnam'] (http://php.net/tempnam) (더 이상!) 편리 할 것입니다. – Charles