php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9804 Incorrect File type check
Submitted: 2001-03-17 04:22 UTC Modified: 2001-04-16 05:42 UTC
From: the_man01 at hotmail dot com Assigned:
Status: Closed Package: GD related
PHP Version: 4.0.4pl1 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: the_man01 at hotmail dot com
New email:
PHP Version: OS:

 

 [2001-03-17 04:22 UTC] the_man01 at hotmail dot com
I'm attempting to create a script that accepts  bmp and jpg files uploaded by a user and converts them into jpg or bmp files as requested by the user, using the ImageCreateFromWBMP, and ImageJPEG functions. But, each time I upload a BMP or JPEG image, I get the message:

"Warning: imagecreatefromwbmp: 'image.bmp' is not a valid WBMP file in /script/location/here.php on line#"

These BMP and jpeg images are created in photoshop 5.5, and windows paint program on win 2000, and 98 platforms and according to thos programs, the file-types are valid.

But, if I use the imagecreate function to generate a  jpeg image (from a string of text), save, and upload that jpeg file to my server, then run the same script on it to convert it to another file format, no error/warning messages are generated.... So apparantly, php can work on images generated by a php script, but no others.

What makes it even more odd, is that upon uploading an image (one made in photoshop or paint) using my script, I have it setup such that a confirmation screen is generated where the users are provided with the size and format/type of the uploaded file, and theyre always reported as being:
image/jpg
or image/bmp
yet they are flagged as invalid when another php script attempts to manipulate them.

is the problem on my end, am I doing something wrong? Is it that php can't handle images created by photoshop  and paint?  or is that the criteria used to validate the image format in php is flawed?

Thanx.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-17 05:28 UTC] the_man01 at hotmail dot com
in my original post, I made refernce to WBMP files.  that should have been GIF files, not WBMP. So the problem im having is with GIF, and JPEG files.
 [2001-03-17 13:17 UTC] sniper@php.net
Please add a shortest possible script into this bug report
which can be used to reproduce this problem.


--Jani
 [2001-04-16 05:42 UTC] jmoore@php.net
This is caused by  gd not returhning an imagepointer and from the sounds of it is a bug in GD and not PHP, the error message is slightly misleading although this is the most likley cause. If the same script is working with php created jpegs etc then your images are either being corrupted or its a bug in GD. It does not look like a bug in PHP.

- James
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 06:01:30 2024 UTC