verot / class.upload.php

This PHP class uploads files and manipulates images very easily. It is in fact as much as an image processing class than it is an upload class. Compatible with PHP 4, 5, 7 and 8. Supports processing of local files, uploaded files, files sent through XMLHttpRequest.
http://www.verot.net/php_class_upload.htm
GNU General Public License v2.0
853 stars 359 forks source link

Bmp format conversion error #169

Closed icret closed 1 year ago

icret commented 1 year ago

I want to convert the bmp image to webp, but no matter what format is converted, it will display: Bmp format conversion error. upload log:


- class version : 30\/08\/2022
- operating system : WINNT
- PHP version : 7.3.4
- GD version : 2.1.0
- supported image types : png webp jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 100M (104857600 bytes)
- language : en
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- checking MIME type with Fileinfo PECL extension
    MAGIC path defaults to C:\\phpstudy_pro\\Extensions\\php\\php7.3.4nts\/extras\/magic
    MAGIC path will not be used
    MIME type detected as image\/x-ms-bmp; charset=binary by Fileinfo PECL extension
- MIME validated as image\/x-ms-bmp
- file is an image, and its type is supported by GD
source variables
- you can use all these before calling process()
    file_src_name : 20230105211232.bmp
    file_src_name_body : 20230105211232
    file_src_name_ext : bmp
    file_src_pathname : C:\\Users\\Administrator\\AppData\\Local\\Temp\\php3EC6.tmp
    file_src_mime : image\/x-ms-bmp
    file_src_size : 8048694 (max= 104857600)
    file_src_error : 0
- source file is an image
    image_src_x : 1920
    image_src_y : 1048
    image_src_pixels : 2012160
    image_src_type : bmp
    image_src_bits : 32
process file to C:\/phpstudy_pro\/WWW\/i\/2023\/01\/05\/\\
- file size OK
- file mime OK : image\/x-ms-bmp
- file extension OK : bmp
- new file name ext : webp
- new file name body : 10ma3w2
- file name safe format
- destination variables
    file_dst_path : C:\/phpstudy_pro\/WWW\/i\/2023\/01\/05\/\\
    file_dst_name_body : 10ma3w2
    file_dst_name_ext : webp
- checking for auto_rename
- destination file details
    file_dst_name : 10ma3w2.webp
    file_dst_pathname : C:\/phpstudy_pro\/WWW\/i\/2023\/01\/05\/\\10ma3w2.webp
- 10ma3w2.webp doesn't exist already
- auto-rotate requires function exif_read_data to be enabled
- image resizing or conversion wanted
- error: Error in creating BMP image from source.```

This is the same phenomenon under IIS, including debian 10 x64 php 7.4 + Nginx 
verot commented 1 year ago

Not sure what is going on... You can try to remove the @ before the calls to @$this->imagecreatefrombmp() in order to see more errors.

Note that I don't really support the class on Windows. I ran some tests on debian PHP 7.4, and it could load BMP files fine.

icret commented 1 year ago

Not sure what is going on... You can try to remove the @ before the calls to @$this->imagecreatefrombmp() in order to see more errors.

Note that I don't really support the class on Windows. I ran some tests on debian PHP 7.4, and it could load BMP files fine.

I removed @, but did not get any more error information. I ran some tests on debian PHP 7.4.

icret commented 1 year ago

I try to rebuild the environment and try to use the latest version to give feedback.