file_example_WEBP_1500kB.webp

 

이거 화두를 끄집어 내기는 하지만 어디서부터 어떻게 해야할지 정리가 좀 안되네요.


이미지프로세스 이번 버전에 ImageMagick, Imagick에 이어서 Magick까지 지원을 하려고 생각했었습니다.

처음 ImageMagick을 설치할때는 배포판이 없어서 소스를 구해서 컴파일해서 설치했었습니다.
요즘에는 록키리눅스 기준으로 ImageMaick은 물론 Imagick까지 dnf, yum으로 바로 설치가 되니 세상 편해졌습니다.


php로 테스트한 결과 기존의 ImageMagick하고 별반 차이가 없어서 바로 적용이 가능할 것이라고 생각했는데..............
라이믹스내에서는 exec()으로 실행되지 않습니다.
원인을 찾으려고 한참을 끙끙거렸습니다.

 

우선 webp와 heic 샘플화일을 구해서 테스트했습니다.

<?php
exec('/usr/bin/magick identify ./dwsample-heic-4k.heic', $out, $returnval);
print_r($out);
print_r($returnval);
exec('/usr/bin/magick identify ./file_example_WEBP_1500kB.webp', $out1,  $returnval);
print_r($out1);
print_r($returnval);
?>

 

$ php magick_5.php

Array
(
    [0] => ./dwsample-heic-4k.heic HEIC 3840x2160 3840x2160+0+0 8-bit sRGB 5.05766MiB 0.000u 0:00.092
)
04Array
(
    [0] => ./file_example_WEBP_1500kB.webp WEBP 5760x3840 5760x3840+0+0 8-bit sRGB 1.42188MiB 1.070u 0:01.101
)

잘됩니다.


이것을 라이믹스 외부페이지에서 불러보면 안됩니다.

Array ( ) Array ( )

 

라이믹스 2.1.2에 외부실행프로그램에 /usr/bin/magick을 입력해고
web, heic 변환에 체크한후
화일을 업로드해보면
webp는 변환이 잘 됩니다.
하지만 heic는 이미지로 변환되지 않고 바로 업로드됩니다.

K-1763.png


adjustUploadedImage($file_info, $config) 에서 디버그를 찍어보면

if (in_array($file_info['extension'], ['avif', 'heic', 'heif']) && !empty($config->magick_command))
        {
            $command = \RX_WINDOWS ? escapeshellarg($config->magick_command) : $config->magick_command;
            $command .= ' identify ' . escapeshellarg($file_info['tmp_name']);
            @exec($command, $output, $return_var);
debugPrint($output);
debugPrint($return_var);

 

Debug Entries
=============
01. 'Array
(
)'
    - modules/file/file.controller.php line 1035
    - modules/file/file.controller.php line 845
    - modules/file/file.controller.php line 140
    - classes/module/ModuleObject.class.php line 754
    - classes/module/ModuleHandler.class.php line 697
    - index.php line 52
02. '126'
    - modules/file/file.controller.php line 1036
    - modules/file/file.controller.php line 845
    - modules/file/file.controller.php line 140
    - classes/module/ModuleObject.class.php line 754
    - classes/module/ModuleHandler.class.php line 697
    - index.php line 52

[2023-07-12 09:03:26]

 

$return_var가 0이 나와야하는데 엉뚱한 숫자가 나옵니다.
magick은 모든 리눅스 커널 버전과 상관없이 동작하게하려고 AppImage라는 독특한 환경이 되어야 동작합니다.
록키리눅스의 경우 fuse가 설치되지 않으면 동작하지 않습니다. (sudo dnf install fuse)
php에서는 되는데 라이믹스에서는 안되는 것이 AppImage 환경과 관계가 있지않을까 생각하지면 더이상은 제가 테스트해볼 수 있는 방법이 없어서 항복했습니다.

 

여기 xetown도 마찬가지로 webp는 변환되는데 동시에 업로드한 heic는 변환되지 않습니다.

 

뭔지모르지만 magick 설정에서 뭔가 해야될 것같기는 한데... 잘 모르겠습니다.

좌우간 조금 조심스럽습니다만 현상황에서  결론은 "magick은 라이믹스에서는 동작하지 않는다."가 맞는 것같습니다.
 

Atachment
첨부

karma

profile
imageprocess, 통합검색확장모듈
아빠팬더곰은 영원한 초보
  • profile
    동작하니까 코어에 저렇게 적용해 놓았지요. 오래된 코드도 아니고 불과 한달여 전에 추가된 기능이고, 3가지 서버 환경(우분투, 록키, 맥OS)에서 동작을 확인한 부분입니다.

    OS에서 정식 지원하는 버전이 아니어서 설치하는 방법도 일정하지 않다 보니, 각 서버의 AppImage 보안정책이나 SELinux 등에 따라 차이가 발생할 수는 있습니다.
  • profile profile

    SELinux를 끄고 하니까 동작하네요.

    감사합니다.

    SELinux 설정에 대해서 좀더 찾아봐야겠습니다.

    K-1764.png