zoukankan      html  css  js  c++  java
  • phpcms 无法显示缩略图 Call to undefined function image_type_to_extension

    问题背景:

    线下的phpcms项目没问题,线上的phpcms新添加的图片缩略图显示有问题,查看了一下php版本,线下是5.5的,线上的是5.1的

    问题原因:

    看了一下线上的错误日志,显示:

     PHP Fatal error:  Call to undefined function image_type_to_extension()

    搜索发现image_type_to_extension这个方法是php5.2以后才有的。

    解决办法:

    1.升级php到5.2以上版本

    2.修改源码,添加判断语句

    - 打开`./phpcms/libs/classes/image.class.php`第37行
    - 找到

    $imagetype = strtolower(substr(image_type_to_extension($imageinfo[2]),1));

    将其替换为

     if(function_exists(image_type_to_extension)){
            $imagetype = strtolower(substr(image_type_to_extension($imageinfo[2]),1));
     }else{
            $imagetype = strtolower(substr($img,strrpos($img,'.')+1));
     }
  • 相关阅读:
    (十六)分页
    (十五)条件查询
    (十四)hibernate逆向工程
    (十三)信息发布管理
    (十二)系统权限
    (十一)角色管理
    (十)系统异常处理
    (九)表单校验
    POI操作Excel
    (八)头像上传
  • 原文地址:https://www.cnblogs.com/savokiss/p/4030552.html
Copyright © 2011-2022 走看看