This is a discussion on rare, intermittent bug with getimagesize ? within the PHP Language forums, part of the PHP Programming Forums category; I've got an intermittent bug that is very hard to trace. On my site, if I log into a ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I've got an intermittent bug that is very hard to trace. On my site, if I log into a new account and try to upload some images, something goes wrong the first time. Everything works fine after the first time, but the first time getimagesize fails to return a type, which is blank in the following error messge. I'm going to check for weird path issues that might be related to first login, but is anyone aware of situations where getimagesize doesn't return a type? list ($w, $h, $type, $attr) = getimagesize ($src_path); if (($side = $w) > $h) $side = $h; $dst = imagecreatetruecolor (PHOTO_SIDEX, PHOTO_SIDEY); if ($type == 1 || $type == 2 || $type == 3 || $type == 6) { /// lots of code goes here } else { $controller->error("In makeCroppedPhoto the type of image was '$type' for image '$src_path' which is not an allowed type. All that is allowed is gif(1), jpg(2), png(3) and bmp(6)."); } |
|
|||
|
lawrence k wrote: > I've got an intermittent bug that is very hard to trace. On my site, if > I log into a new account and try to upload some images, something goes > wrong the first time. Everything works fine after the first time, but > the first time getimagesize fails to return a type, which is blank in > the following error messge. I'm going to check for weird path issues > that might be related to first login, but is anyone aware of situations > where getimagesize doesn't return a type? > > > list ($w, $h, $type, $attr) = getimagesize ($src_path); > if (($side = $w) > $h) $side = $h; > $dst = imagecreatetruecolor (PHOTO_SIDEX, PHOTO_SIDEY); > > if ($type == 1 || $type == 2 || $type == 3 || $type == 6) { > /// lots of code goes here > } else { > $controller->error("In makeCroppedPhoto the type of image was '$type' > for image '$src_path' which is not an allowed type. All that is allowed > is gif(1), jpg(2), png(3) and bmp(6)."); } Additional testing makes this seem even more odd. fileperms() returns 33279 which is -rwxrwxrwx a mime-type command I have correctly returns "image/jpeg" but getimagesize is returning blank. when i hit it with print_r I get nothing And all of the 3 above commands are being handed the same address. |