Hello all
As of today, access to thumb.php has been disabled for performance reasons. (Update: TimStarling offered to re-enable it for now. But it WILL go away SOON).
Thumbnail images need to be accessed by their real path, like
http://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Meerkatmascotfull.p...
Note that this will work for any size, if a thumbnail in the requested size doesn't exist, it is created on-the-fly. There are two problems with this:
1) you have to know if the image is on commons or not 2) you have to know the path for the images of a given wiki (in this case, "/wikipedia/commons")
Note that Special:FilePath SHOULD NOT BE USED to get the URL of the full size image, for performance reasons.
You should also NOT USE THE API to get the actual URL - for the same reason. We have to get all info needed locally from the toolserver, from the database or otherwise.
The best solution IMHO would be a small script on the toolserver that, given a wiki, an image, and a size, will generate an HTTP redirect to the image file. This would require us to maintain a database of URL prefixes for all wikis - could be done as a new column in toolserver.wiki. And for each request, the script needs to run a query to see if the image is uploaded locally or not.
I'll not be able to build such a script for a while, because I'm quite busy. DaB said he'd look into it. Let's hope for the best.
-- Daniel
PS: @river: this should really go to to toolser-announce. apparently, i can't post there. please change that :)
Hello, Am Donnerstag 04 September 2008 19:05:57 schrieb Daniel Kinzler:
DaB said he'd look into it. Let's hope for the best.
I'm done for first. You can find my programm at
http://toolserver.org/tsthumb/tsthumb . If you find any error (experiments with chinese-named pictures would be nice), please report it to JIRA.
Sincerly, DaB.
DaB. wrote:
I'm done for first. You can find my programm at
http://toolserver.org/tsthumb/tsthumb . If you find any error (experiments with chinese-named pictures would be nice), please report it to JIRA.
Sincerly, DaB.
Looks i'm (un)lucky. I got a java.lang.NullPointerException on the first try. What about sending to the full sizeimage if a size bigger than the image is requested? Also, as you're issuing a redirect, what are the risks if someone was able to upload a malicious file to the servers? (the thumbnailing process may guard against it)
What about sending to the full sizeimage if a size bigger than the image is requested? Also, as you're issuing a redirect, what are the risks if someone was able to upload a malicious file to the servers? (the thumbnailing process may guard against it)
Make it only deliver the original if explicitly asked for it. Then it would also be a replacement for Special:Filepath
I'm done for first. You can find my programm at http://toolserver.org/tsthumb/tsthumb
And where can I find the source code? It seems your redirect tool does not work when supplying HTTP Range headers. Daniel
On Tue, Sep 23, 2008 at 23:53, Daniel Schwen lists@schwen.de wrote:
And where can I find the source code? It seems your redirect tool does not work when supplying HTTP Range headers.
Apparently, in SVN: https://fisheye.toolserver.org/browse/dab/TS-thumb/
Though I as well have no ideas about how to alter the running version.
— Kalan
And where can I find the source code? It seems your redirect tool does not work when supplying HTTP Range headers.
Apparently, in SVN: https://fisheye.toolserver.org/browse/dab/TS-thumb/
Ok, pretty trivial. In case someone ever needs a python snippet for let's say a pywikipedia based bot:
import hashlib import urllib2 m = hashlib.md5() m.update( name ) h = m.hexdigest() url = "http://upload.wikimedia.org/wikipedia/commons/thumb/%s/%s/%s/120px-%s%22%5C % ( h[0], h[0:2], urllib2.quote(name), urllib2.quote(name) )
Just take "name" straight as mysql returns it from a db query, otherwise the hash will most likely be wrong.
toolserver-l@lists.wikimedia.org