Phpcms cannot display thumbnails call to undefined function image_type_to_extension

Source: Internet
Author: User

Issue background:

Offline Phpcms Project No problem, the online phpcms newly added picture thumbnail shows a problem, check the PHP version, the offline is 5.5, the line is 5.1

Cause of the problem:

Looked at the error log on the line, showing:

PHP Fatal Error: Call to  undefined function image_type_to_extension ()

Search found Image_type_to_extension This method is php5.2 later.

Workaround:

1. Upgrade PHP to 5.2 or later

2. Modify the source code, add judgment statement

-Open './phpcms/libs/classes/image.class.php ' line 37th
-Find

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

Replace it with a

if (function_exists(image_type_to_extension)) {        $imagetypestrtolower(  Substr(image_type_to_extension ($imageinfo[2]), 1)); }Else{        $imagetypestrtolower(substr($img ,strrpos($img, '. ') +1)); }

Phpcms cannot display thumbnails call to undefined function image_type_to_extension

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.