• Skip to primary navigation
  • Skip to main content

Algorithm.co.il

  • About
  • Best Posts
  • Origami
  • Older Projects

Wikipedia Images

Posted on 2011-06-21 by lorg 3 Comments

A few days ago a friend (x) of a friend (y) showed me and my friend (y) a small app he was developing, that had photos from flickr and picasa. We suggested adding photos from Wikipedia as well, but he (x) said that the photos were too big, and it was too much trouble resizing them.
Luckily for him I knew of Wikipedia’s “hidden” image resizing feature, and as it was useful to me and to someone else, I thought I’d share it here.

Let’s say you are looking to resize the following image of the Eiffel Tower: http://en.wikipedia.org/wiki/File:Tour_Eiffel_Wikimedia_Commons.jpg. Then the url to the image itself is:

http://upload.wikimedia.org/wikipedia/commons/a/a8/Tour_Eiffel_Wikimedia_Commons.jpg

To get the url to a resized image, just add ‘thumb/’ after ‘commons/’ and then add ‘/[%d]px-[filename]’ at the end, were %d is the new width. So for our image, the new url would be:

http://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Tour_Eiffel_Wikimedia_Commons.jpg/300px-Tour_Eiffel_Wikimedia_Commons.jpg

That’s it, simple and quick. Have fun adding Wikipedia to your content!

Filed under: Programming

Reader Interactions

Comments

  1. Uriel Katz says

    2011-06-21 at 11:59 pm

    Nice hack!
    Were did you find this? in the wiki source code? :)

    Reply
    • lorg says

      2011-06-22 at 12:07 am

      No, just by playing with various image links on Wikipedia.

      Reply
  2. Amit Zur says

    2011-08-15 at 11:21 am

    Great one. I can contribute also that I found the same thing for gravatar, e.g. http://2.gravatar.com/avatar/1ad9e5c98d81c6815a65dab5b6e1f669?size=120

    ?size=x where x is any number (i think up to ~530)

    Reply

Leave a Reply Cancel reply

© 2022 Algorithm.co.il - Algorithms, for the heck of it