Last modified: 2012-12-01 10:23:40 UTC
If you upload an image with an EXIF GPSAltitude, and then fetch imageinfo via the API, you just get the difficult-to-work-with "rational" value, such as "9395/128". Many other fields, such as FocalLength, GPSTimestamp, etc. are displayed as rationals. However GPSLatitude and GPSLongitude are shown with the expected "decimal" values. Example: do this API query on test.wikipedia.org. http://test.wikipedia.org/w/api.php?action=query&titles=File%3ATest_rationals%2Ejpg&prop=imageinfo&iiprop=metadata A sample result is attached to this bug. You can also import that file into your own wiki to do testing. The Exif module that handles bitmaps seems to have the fields tagged correctly as Exif::RATIONAL, so I'm not sure exactly what is going wrong; whether it's when the file is uploaded or how we render results in the API.
Created attachment 9447 [details] Sample API results showing rationals where decimals expected
Created attachment 9448 [details] Sample API results showing rationals where decimals expected (JSON)
This is the expected behaviour. (Mostly because that's the way its been forever and ever. It would perhaps make sense to convert the rationals to decimals before storing in db, or even convert it just for api output). GPSLatitude is different just because the array of three values is just plain annoying to deal with ;)
*** Bug 32608 has been marked as a duplicate of this bug. ***
*** Bug 35015 has been marked as a duplicate of this bug. ***
I submitted Gerrit change #20288 which changes the behaviour just for GPSAltitude, since some of my other code was assuming it was a normal floating point number, which caused totally wrong displays when the altitude was below sea level. I still feel that things which use the image metadata from MediaWiki should not make assumptions as to if the data is a rational number or a normal real number. In the future I do think it should probably be changed to convert all those fields (except maybe shutter speed) [converting them would be a mild breaking change in the api, but i doubt anyone would care]. However, even if that is done, anything using the image metadata from mediawiki would still have to support both rational numbers and normal decimal numbers, since the metadata from files stays cached for a long time (years).
The upload wizard fails for every geocoded file that I upload, unless I manually change the Altitude field from 0/1 to 0. This field is hidden by default in the "Add categories and more information ..." section, and if you don't open that section the upload simply fails without explaining what the problem is.
@Gary, for the UW specific part, I filed bug 39553
(In reply to comment #6) > I submitted Gerrit change #20288 which changes the behaviour just for Status Merged, bug maybe resolved