When PNG image is uploaded, it's width and height are shown as zero. This doesn't happen for JPGs. When trying to generate thumbnails from such image, "FILE.png is not an image." error message is shown.

Environment: Drupal 6.1, IMCE 6.x-1.x-dev, PHP 5.2 (incl. GD), PostgreSQL 8.3.

Comments

ufku’s picture

Status: Active » Fixed

confirmed. this issiue is valid for some php configurations where IMG_PNG constant is not defined.
committed a fix for the -dev branch.

ogi’s picture

Happy to see this fixed, I rushed to look how it's fixed and I was very surprised. array(IMG_GIF, IMG_JPG, IMG_PNG) is replaced with array(1, 2, 3)?! This doesn't look like good coding practice. Are you sure you want to fix it this way? It's strange that I didn't find information about IMG_PNG not defined in some installations. Does this comment help for nicer solution?

ufku’s picture

Hmm, It's now clear why IMG_PNG didn't work.
IMG_ prefixed constants may not be equal to IMAGETYPE_ prefixed constants.
It was a mistake to use the IMG_ constants because getimagesize() returns IMAGETYPE_ constants.
Thank you Ognyan for pointing this out.
I'll replace the integers with IMAGETYPE_ equivalents.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.