Jump to content

Recommended Posts

There is this url - http://xkcd.com/1110/ . It has an interactive image, witch is made out of 225 other images (its very big). I want to make a php script that would download all those 225 images. For example - http://imgs.xkcd.com/clickdrag/1n8w.png. 1n8w.png is one of those images, if i write 1n9w.png it would load another image.

 

I think i do not explain myself well enough, so i am going to post how other ppl got the images but using other method:

 

This is what I did:

I figured out, that the map pieces follow the URL pattern

http://imgs.xkcd.com/clickdrag/X[n|s]Y[e|w].png,

where n, s, e, w are characters to select the quadrant, and X and Y are positive integers (>=1) with no zero padding. The images are each 2048×2048 pixels in size and are arranged in an orthogonal grid.

The bounds can be found in the JavaScript file http://imgs.xkcd.com/clickdrag/1110.js:

var size=[14, 48, 25, 33];

These are the bounds of [n, e, s, w] respectively, however, I did only find images for [13, 48, 19, 33], a little bit less in the n-s direction, but maybe I was missing something.

I did a brute force download of all the images (sorry Randall) using simple DOS shell commands like this for the s-e-quadrant:

FOR /L %x IN (1,1,25) DO FOR /L %y IN (1,1,48) DO wget http://imgs.xkcd.com/clickdrag/%xs%ye.png

I got 225 files that existed, all others are completely black or white and returned a 404-Not found.

 

I do not know what DOS shell is, or what those command lines are, i do understand what that code does tho. Is it possible to make something like this but with php?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.