Skip to content

Conversation

GBuella
Copy link
Contributor

@GBuella GBuella commented Apr 4, 2014

No description provided.

@smalyshev
Copy link
Contributor

I wonder if this is the best way to do it - according to http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx negative length has different meaning than positive length, so just losing this information does not look the best way. It's better than giving wrong height but maybe there's even better way to do it?

@GBuella
Copy link
Contributor Author

GBuella commented Apr 7, 2014

Well, for example getimagesize might also return another boolean field called "topdown".
Much like GD calls it : https://bitbucket.org/libgd/gd-libgd/src/4b86e06937bc/src/gd_bmp.c#cl-638
An like MS calls it : http://msdn.microsoft.com/en-us/library/windows/desktop/dd407212.aspx

But this would make it not totally backward compatible, for bmp specific data. We do "lose" other information as well, from the bitmap header. We do lose other information from JPEG, etc... headers using getimagesize.

Meanwhile, I'm pretty sure getimagesize needs to return the absolute value of height here. That is what users expect, after all, the name suggests this, not other fields of headers.
For example, we had our production code reject a users uploaded image with an error message saying the image is too large, while it was just a valid bmp. I suspect other codebases can also contain validation like ($height <= $max_height)

@php-pulls
Copy link

Comment on behalf of stas at php.net:

merged

@php-pulls php-pulls closed this Apr 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants