0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

LightSail(LAMP/Bitnami)でImagickを利用したときにハマった

Last updated at Posted at 2021-03-29

EC-CUBE4 を利用する中で、カスタマイズした際にImagickを利用した処理を追加。

環境は、LightSailのLAMP環境(Bitnami)。

これをステージング環境にデプロイした際、以下のエラーが発生。

no decode delegate for this image format `JPEG'

Imagick は、以下で有効済み。

で、コマンドで ImageMagick を確認。

$ php -i | grep ImageMagick
Imagick compiled with ImageMagick version => ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Imagick using ImageMagick library version => ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
ImageMagick copyright => © 1999-2019 ImageMagick Studio LLC
ImageMagick release date => 20190101
ImageMagick number of supported formats:  => 242
ImageMagick supported formats => 3FR, 3G2, 3GP, AAI, AI, ART, ARW, AVI, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV

特に問題なさそう。

で、管理画面側で改めて phpinfo() を確認すると ImageMagick number of supported formats: 0 に。
ImageMagick supported formatsno value

phpinfo.png

コマンドと、php-fpm が実行している php のバージョンとかが違うのかなぁと思ったけど、そうでもない。

で、数時間悩んだ挙げ句、他の人にチェックしてもらったら、以下が設定されていないよーという指摘。

$_SERVER['MAGICK_HOME']
$_SERVER['MAGICK_CODER_MODULE_PATH']
$_SERVER['MAGICK_CONFIGURE_PATH']

はい、これが原因でした。

これに対応するために、以下に変更。

/opt/bitnami/php/etc/environment.conf

env[MAGICK_HOME] = /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10/
env[MAGICK_CONFIGURE_PATH] = /etc/ImageMagick/
env[MAGICK_CODER_MODULE_PATH] = /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.10/modules-Q16/coders

ImageMagick supported formats も正常になりました。
めでたし、めでたし。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?