I was working lately on a template on commons related to automatic overlay KML creation (see [1] for KML use on Commons). Two of the items I need but do not know how to access are full file dimensions in pixels and the url to the raw image (like [2]). I think with Lua, I can use HTML Parser [3] to parse the file page, but there must be a simpler way to access those.
Jarek T.
(user:jarekt http://commons.wikimedia.org/wiki/User:Jarekt )
[1] https://commons.wikimedia.org/wiki/Commons:Geocoding/Overlay
[2] https://upload.wikimedia.org/wikipedia/commons/3/36/Covington%2C_Indiana _map_from_1876_atlas.jpg
On Jan 3, 2014 7:04 AM, "Tuszynski, Jaroslaw W." < JAROSLAW.W.TUSZYNSKI@leidos.com> wrote:
I was working lately on a template on commons related to automatic overlay KML creation (see [1] for KML use on Commons). Two of the items I need but do not know how to access are full file dimensions in pixels and the url to the raw image (like [2]). I think with Lua, I can use HTML Parser [3] to parse the file page, but there must be a simpler way to access those.
Jarek T.
(user:jarekt http://commons.wikimedia.org/wiki/User:Jarekt )
[1] https://commons.wikimedia.org/wiki/Commons:Geocoding/Overlay
[2] https://upload.wikimedia.org/wikipedia/commons/3/36/Covington%2C_Indiana _map_from_1876_atlas.jpg
[3] https://commons.wikimedia.org/wiki/Module:HTMLParser
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
You can link to special:filepath/filename to get path, but full dimensions are unavailablr.
-bawolff
Am 03.01.2014 18:37, schrieb Brian Wolff:
On Jan 3, 2014 7:04 AM, "Tuszynski, Jaroslaw W." < JAROSLAW.W.TUSZYNSKI@leidos.com> wrote:
I was working lately on a template on commons related to automatic overlay KML creation (see [1] for KML use on Commons). Two of the items I need but do not know how to access are full file dimensions in pixels and the url to the raw image (like [2]). I think with Lua, I can use HTML Parser [3] to parse the file page, but there must be a simpler way to access those.
Jarek T.
(user:jarekt http://commons.wikimedia.org/wiki/User:Jarekt )
[1] https://commons.wikimedia.org/wiki/Commons:Geocoding/Overlay
[2] https://upload.wikimedia.org/wikipedia/commons/3/36/Covington%2C_Indiana _map_from_1876_atlas.jpg
[3] https://commons.wikimedia.org/wiki/Module:HTMLParser
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
You can link to special:filepath/filename to get path, but full dimensions are unavailablr.
Wouldn't it be a solution to add the full dimensions (+ MIME type etc) to the API (&prop=imageinfo&iiprop=extmetadata), would it?
Raimond.
On Jan 3, 2014 11:02 AM, "Raimond Spekking" raimond.spekking@gmail.com wrote:
Am 03.01.2014 18:37, schrieb Brian Wolff:
On Jan 3, 2014 7:04 AM, "Tuszynski, Jaroslaw W." < JAROSLAW.W.TUSZYNSKI@leidos.com> wrote:
I was working lately on a template on commons related to automatic overlay KML creation (see [1] for KML use on Commons). Two of the items I need but do not know how to access are full file dimensions in pixels and the url to the raw image (like [2]). I think with Lua, I can use HTML Parser [3] to parse the file page, but there must be a simpler way to access those.
Jarek T.
(user:jarekt http://commons.wikimedia.org/wiki/User:Jarekt )
[1] https://commons.wikimedia.org/wiki/Commons:Geocoding/Overlay
[2]
https://upload.wikimedia.org/wikipedia/commons/3/36/Covington%2C_Indiana
_map_from_1876_atlas.jpg
[3] https://commons.wikimedia.org/wiki/Module:HTMLParser
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
You can link to special:filepath/filename to get path, but full
dimensions
are unavailablr.
Wouldn't it be a solution to add the full dimensions (+ MIME type etc) to the API (&prop=imageinfo&iiprop=extmetadata), would it?
Raimond.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I believe Jarek is looking to get the info from wikitext, so that wouldnt help him. Additionally if you have access to the api, you can use iiprop=dimensions already.
This is a somewhat commonly requested thing (e.g. some folks on wikipedia want to make a gallery lua module that takes aspect ratio into account), so adding an interface to lua to retrieve this info would make sense imo.
-bawolff
I am (vaguely) aware of API call capabilities, for example I know ImageAnnotator.js [1] has access to image size, since it is using it. But Bawolff is right, I am trying to access it from Lua or template code.
As for file path, I am still confused. I tried to use Special:ExpandTemplates to test several possible syntaxes:
[[Special:filepath/Verschaffelt Moses von Michelangelo.jpg]] [[Special:Redirect/file/Verschaffelt Moses von Michelangelo.jpg]] [[:Special:Redirect/file/Verschaffelt Moses von Michelangelo.jpg]] {{subst:Special:Redirect/file/Verschaffelt Moses von Michelangelo.jpg}}
And the first 3 give me a blue-link while the 4-th one does not work. I was hoping to get "https://upload.wikimedia.org/wikipedia/commons/3/34/Verschaffelt_Moses_von_M..." string. KML files like [2] , called by our templates [3] hotlinking directly to commons images.
Jarek T. (user:jarekt)
[1] https://commons.wikimedia.org/wiki/MediaWiki:Gadget-ImageAnnotator.js [2] https://commons.wikimedia.org/wiki/File:Alluvial_fan,_Taklimakan_Desert,_Xin... [3] https://maps.google.com/maps?hq=http://toolserver.org/~dschwen/kml.php%3Fpag...
-----Original Message----- From: wikitech-l-bounces@lists.wikimedia.org [mailto:wikitech-l-bounces@lists.wikimedia.org] On Behalf Of Brian Wolff Sent: Friday, January 03, 2014 1:12 PM To: wikitech-l Subject: Re: [Wikitech-l] Is file location and file size aviable to templates
On Jan 3, 2014 11:02 AM, "Raimond Spekking" raimond.spekking@gmail.com wrote:
Am 03.01.2014 18:37, schrieb Brian Wolff:
On Jan 3, 2014 7:04 AM, "Tuszynski, Jaroslaw W." < JAROSLAW.W.TUSZYNSKI@leidos.com> wrote:
I was working lately on a template on commons related to automatic overlay KML creation (see [1] for KML use on Commons). Two of the items I need but do not know how to access are full file dimensions in pixels and the url to the raw image (like [2]). I think with Lua, I can use HTML Parser [3] to parse the file page, but there must be a simpler way to access those.
Jarek T.
(user:jarekt http://commons.wikimedia.org/wiki/User:Jarekt )
[1] https://commons.wikimedia.org/wiki/Commons:Geocoding/Overlay
[2]
https://upload.wikimedia.org/wikipedia/commons/3/36/Covington%2C_Indiana
_map_from_1876_atlas.jpg
[3] https://commons.wikimedia.org/wiki/Module:HTMLParser
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
You can link to special:filepath/filename to get path, but full
dimensions
are unavailablr.
Wouldn't it be a solution to add the full dimensions (+ MIME type etc) to the API (&prop=imageinfo&iiprop=extmetadata), would it?
Raimond.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I believe Jarek is looking to get the info from wikitext, so that wouldnt help him. Additionally if you have access to the api, you can use iiprop=dimensions already.
This is a somewhat commonly requested thing (e.g. some folks on wikipedia want to make a gallery lua module that takes aspect ratio into account), so adding an interface to lua to retrieve this info would make sense imo.
-bawolff _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
You can do {{filepath:Verschaffelt Moses von Michelangelo.jpg}} (Sorry, probably should have said that in the first place)
-bawolff On Jan 3, 2014 12:34 PM, "Tuszynski, Jaroslaw W." < JAROSLAW.W.TUSZYNSKI@leidos.com> wrote:
I am (vaguely) aware of API call capabilities, for example I know
ImageAnnotator.js [1] has access to image size, since it is using it. But Bawolff is right, I am trying to access it from Lua or template code.
As for file path, I am still confused. I tried to use
Special:ExpandTemplates to test several possible syntaxes:
[[Special:filepath/Verschaffelt Moses von Michelangelo.jpg]] [[Special:Redirect/file/Verschaffelt Moses von Michelangelo.jpg]] [[:Special:Redirect/file/Verschaffelt Moses von Michelangelo.jpg]] {{subst:Special:Redirect/file/Verschaffelt Moses von Michelangelo.jpg}}
And the first 3 give me a blue-link while the 4-th one does not work. I
was hoping to get " https://upload.wikimedia.org/wikipedia/commons/3/34/Verschaffelt_Moses_von_M..." string. KML files like [2] , called by our templates [3] hotlinking directly to commons images.
Jarek T. (user:jarekt)
[1] https://commons.wikimedia.org/wiki/MediaWiki:Gadget-ImageAnnotator.js [2]
https://commons.wikimedia.org/wiki/File:Alluvial_fan,_Taklimakan_Desert,_Xin...
[3]
https://maps.google.com/maps?hq=http://toolserver.org/~dschwen/kml.php%3Fpag...
-----Original Message----- From: wikitech-l-bounces@lists.wikimedia.org [mailto:
wikitech-l-bounces@lists.wikimedia.org] On Behalf Of Brian Wolff
Sent: Friday, January 03, 2014 1:12 PM To: wikitech-l Subject: Re: [Wikitech-l] Is file location and file size aviable to
templates
On Jan 3, 2014 11:02 AM, "Raimond Spekking" raimond.spekking@gmail.com wrote:
Am 03.01.2014 18:37, schrieb Brian Wolff:
On Jan 3, 2014 7:04 AM, "Tuszynski, Jaroslaw W." < JAROSLAW.W.TUSZYNSKI@leidos.com> wrote:
I was working lately on a template on commons related to automatic overlay KML creation (see [1] for KML use on Commons). Two of the items I need but do not know how to access are full file dimensions in pixels and the url to the raw image (like [2]). I think with Lua, I can use HTML Parser [3] to parse the file page, but there must be a simpler way to access those.
Jarek T.
(user:jarekt http://commons.wikimedia.org/wiki/User:Jarekt )
[1] https://commons.wikimedia.org/wiki/Commons:Geocoding/Overlay
[2]
https://upload.wikimedia.org/wikipedia/commons/3/36/Covington%2C_Indiana
_map_from_1876_atlas.jpg
[3] https://commons.wikimedia.org/wiki/Module:HTMLParser
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
You can link to special:filepath/filename to get path, but full
dimensions
are unavailablr.
Wouldn't it be a solution to add the full dimensions (+ MIME type etc) to the API (&prop=imageinfo&iiprop=extmetadata), would it?
Raimond.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I believe Jarek is looking to get the info from wikitext, so that wouldnt
help him. Additionally if you have access to the api, you can use iiprop=dimensions already.
This is a somewhat commonly requested thing (e.g. some folks on wikipedia
want to make a gallery lua module that takes aspect ratio into account), so adding an interface to lua to retrieve this info would make sense imo.
-bawolff _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Not to long ago I started a discussion on an mw.file object
https://en.wikipedia.org/wiki/Wikipedia:Lua_requests#How_about_a_mw.file_api
I didn't really get much further than that though.
DJ
On 3 jan. 2014, at 21:03, Brian Wolff bawolff@gmail.com wrote:
You can do {{filepath:Verschaffelt Moses von Michelangelo.jpg}} (Sorry, probably should have said that in the first place)
-bawolff On Jan 3, 2014 12:34 PM, "Tuszynski, Jaroslaw W." < JAROSLAW.W.TUSZYNSKI@leidos.com> wrote:
I am (vaguely) aware of API call capabilities, for example I know
ImageAnnotator.js [1] has access to image size, since it is using it. But Bawolff is right, I am trying to access it from Lua or template code.
As for file path, I am still confused. I tried to use
Special:ExpandTemplates to test several possible syntaxes:
[[Special:filepath/Verschaffelt Moses von Michelangelo.jpg]] [[Special:Redirect/file/Verschaffelt Moses von Michelangelo.jpg]] [[:Special:Redirect/file/Verschaffelt Moses von Michelangelo.jpg]] {{subst:Special:Redirect/file/Verschaffelt Moses von Michelangelo.jpg}}
And the first 3 give me a blue-link while the 4-th one does not work. I
was hoping to get " https://upload.wikimedia.org/wikipedia/commons/3/34/Verschaffelt_Moses_von_M..." string. KML files like [2] , called by our templates [3] hotlinking directly to commons images.
Jarek T. (user:jarekt)
[1] https://commons.wikimedia.org/wiki/MediaWiki:Gadget-ImageAnnotator.js [2]
https://commons.wikimedia.org/wiki/File:Alluvial_fan,_Taklimakan_Desert,_Xin...
[3]
https://maps.google.com/maps?hq=http://toolserver.org/~dschwen/kml.php%3Fpag...
-----Original Message----- From: wikitech-l-bounces@lists.wikimedia.org [mailto:
wikitech-l-bounces@lists.wikimedia.org] On Behalf Of Brian Wolff
Sent: Friday, January 03, 2014 1:12 PM To: wikitech-l Subject: Re: [Wikitech-l] Is file location and file size aviable to
templates
On Jan 3, 2014 11:02 AM, "Raimond Spekking" raimond.spekking@gmail.com wrote:
Am 03.01.2014 18:37, schrieb Brian Wolff:
On Jan 3, 2014 7:04 AM, "Tuszynski, Jaroslaw W." < JAROSLAW.W.TUSZYNSKI@leidos.com> wrote:
I was working lately on a template on commons related to automatic overlay KML creation (see [1] for KML use on Commons). Two of the items I need but do not know how to access are full file dimensions in pixels and the url to the raw image (like [2]). I think with Lua, I can use HTML Parser [3] to parse the file page, but there must be a simpler way to access those.
Jarek T.
(user:jarekt http://commons.wikimedia.org/wiki/User:Jarekt )
[1] https://commons.wikimedia.org/wiki/Commons:Geocoding/Overlay
[2]
https://upload.wikimedia.org/wikipedia/commons/3/36/Covington%2C_Indiana
_map_from_1876_atlas.jpg
[3] https://commons.wikimedia.org/wiki/Module:HTMLParser
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
You can link to special:filepath/filename to get path, but full
dimensions
are unavailablr.
Wouldn't it be a solution to add the full dimensions (+ MIME type etc) to the API (&prop=imageinfo&iiprop=extmetadata), would it?
Raimond.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I believe Jarek is looking to get the info from wikitext, so that wouldnt
help him. Additionally if you have access to the api, you can use iiprop=dimensions already.
This is a somewhat commonly requested thing (e.g. some folks on wikipedia
want to make a gallery lua module that takes aspect ratio into account), so adding an interface to lua to retrieve this info would make sense imo.
-bawolff _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Yes, this would be a pretty straightforward addition to the mw.Title object or something that accepts one as a filename similarly.
https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Titl...
Like the 'fileExists' this might be marked as an 'expensive' operation since doing a lot of them might require a lot of DB lookups.
Note that I've got an old 'fileinfo' extension which used a parser function to fetch some file information which could be updated to provide a Lua interface, but it seems to have gone missing from gerrit (may never have made it over). So.... exercise left for the reader.
-- brion
On Fri, Jan 3, 2014 at 10:11 AM, Brian Wolff bawolff@gmail.com wrote:
On Jan 3, 2014 11:02 AM, "Raimond Spekking" raimond.spekking@gmail.com wrote:
Am 03.01.2014 18:37, schrieb Brian Wolff:
On Jan 3, 2014 7:04 AM, "Tuszynski, Jaroslaw W." < JAROSLAW.W.TUSZYNSKI@leidos.com> wrote:
I was working lately on a template on commons related to automatic overlay KML creation (see [1] for KML use on Commons). Two of the
items
I need but do not know how to access are full file dimensions in
pixels
and the url to the raw image (like [2]). I think with Lua, I can use HTML Parser [3] to parse the file page, but there must be a simpler
way
to access those.
Jarek T.
(user:jarekt http://commons.wikimedia.org/wiki/User:Jarekt )
[1] https://commons.wikimedia.org/wiki/Commons:Geocoding/Overlay
[2]
https://upload.wikimedia.org/wikipedia/commons/3/36/Covington%2C_Indiana
_map_from_1876_atlas.jpg
[3] https://commons.wikimedia.org/wiki/Module:HTMLParser
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
You can link to special:filepath/filename to get path, but full
dimensions
are unavailablr.
Wouldn't it be a solution to add the full dimensions (+ MIME type etc) to the API (&prop=imageinfo&iiprop=extmetadata), would it?
Raimond.
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
I believe Jarek is looking to get the info from wikitext, so that wouldnt help him. Additionally if you have access to the api, you can use iiprop=dimensions already.
This is a somewhat commonly requested thing (e.g. some folks on wikipedia want to make a gallery lua module that takes aspect ratio into account), so adding an interface to lua to retrieve this info would make sense imo.
-bawolff _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org