让nextcloud支持heic、heif,显示heic缩略图

一、安装heic支持组件

注:当ImageMagick版本大于7.1.0-30时,会检查依赖的libheif版本,必须checking for libheif >= 1.4.0

1、低版本,安装简单(libheif-1.3.*** + ImageMagick7.1.0-30)

wget https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm --no-check-certificate
rpm -Uvh rpmfusion-free-release*rpm
//第三方软件库安装libheif,默认低版本
yum install libheif*

参考:https://www.1024sou.com/article/682545.html

2、高版本,繁琐点,不推荐(libheif-1.15.2 + ImageMagick7.1.1-12)

libheif-1.15.2为高版本,大于 1.4.0
最新版本: https://github.com/strukturag/libheif/releases
安装libheic

//先安装 libtool
yum -y install libtool
//再安装 libheif
wget https://github.com/strukturag/libheif/releases/download/v1.15.2/libheif-1.15.2.tar.gz
tar xf libheif-1.15.2.tar.gz
cd libheif-1.15.2
yum -y install gcc-c++
./autogen.sh
CPPFLAGS="-I/usr/local/include" LIBS="-ldl" ./configure --prefix=/usr/lib64
make && make install
cp /usr/lib64/lib/pkgconfig/libheif.pc /usr/lib64/pkgconfig/
//若提示cp: overwrite ‘/usr/lib64/pkgconfig/libheif.pc’?  输入y即可

参考:
https://blog.csdn.net/qq_40460909/article/details/121509692
https://www.xhyz.fun/art/114.html
https://blog.csdn.net/qq_40460909/article/details/121509692
https://blog.csdn.net/u012335601/article/details/100938502

二、安装ImageMagick

//下载资源,结尾改为.tar.gz,并解压
wget https://codeload.github.com/ImageMagick/ImageMagick/tar.gz/refs/tags/7.1.0-30
wget https://codeload.github.com/ImageMagick/ImageMagick/tar.gz/refs/tags/7.1.1-12(新版不支持centos7?)
wget http://www.imagemagick.org/download/ImageMagick.tar.gz(最新版)
//版本集合https://download.imagemagick.org/archive/releases/

//下载到root目录,软件包改为tar.gz后缀,并解压
//进入指定目录
cd /root/ImageMagick-7.1.0-30/
//或者
cd /root/ImageMagick-7.1.1-12/
//配置,查看是否支持heic,不支持换个版本。

./configure --with-heic=yes
//prefix可以把安装包集合在一起,要不会很分散,但是好像最终无法显示出heic图片
//./configure --prefix=/usr/local/imagemagick --with-heic=yes --with-png=yes --with-webp=yes
//./configure --prefix=/usr/local/ImageMagick --enable-shared  --with-heic=yes

//安装
make && make install

三、引入环境

方法1:不可用prefix配置

echo "export PATH=$PATH:/usr/local/ImageMagick/bin" >> /etc/profile
source /etc/profile
ldconfig /usr/local/lib

方法2:适用prefix配置的,convert -version提示安装成功,但是好像最终无法显示出heic图片

vim /etc/profile
LD_LIBRARY_PATH=/usr/local/lib:/usr/local/imagemagick
export LD_LIBRARY_PATH
PATH=$PATH:/usr/local/imagemagick/bin
export PATH

四、安装PHP函数imagick

wget https://pecl.php.net/get/imagick-3.7.0.tgz
tar -xzvf imagick-3.7.0.tgz
cd /root/imagick-3.7.0
/www/server/php/81/bin/phpize
./configure --with-php-config=/www/server/php/81/bin/php-config --with-imagick=/usr/local/ImageMagick
export PKG_CONFIG_PATH=/usr/local/ImageMagick/lib/pkgconfig
make && make install

五、其他

一定要取消禁用函数:proc_open
查看版本:convert -version
删除ImageMagick:sudo yum remove ImageMagick
检查命令看看 imagick 扩展是否安装和启用:php -m | grep -i "imagick"
HEIC缩略图:在config.php内添加 17 => 'OC\\Preview\\HEIC', 重启php nginx

更多参考:
https://blog.csdn.net/nathan_csdn/article/details/126100165
https://blog.csdn.net/qq_33215204/article/details/127795619
https://www.himstudy.net/%e8%a7%a3%e5%86%b3nextcloud%e4%b8%8d%e6%98%be%e7%a4%baheic%e6%96%87%e4%bb%b6%e7%bc%a9%e7%95%a5%e5%9b%be%e7%9a%84%e9%97%ae%e9%a2%98/
https://www.himstudy.net/%E8%A7%A3%E5%86%B3nextcloud%E6%97%A0%E6%B3%95%E5%9C%A8%E7%BA%BF%E6%89%93%E5%BC%80heic%E5%9B%BE%E7%89%87%E7%9A%84%E9%97%AE%E9%A2%98/
https://www.jianshu.com/p/59128bd94d00

make报错:make[1]: *** [server.o] Error 1(已解决)
升级gcc:https://blog.csdn.net/fox372/article/details/111703943

执行编译出来的可执行程序时报错:error while loading shared libraries: xxx.so: cannot open shared object file: No such file or directory
https://blog.csdn.net/weixin_44843859/article/details/110632136

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值