Topic on Project:Support desk

How to use only small images from commons.wikimedia.org?

8
Fokebox (talkcontribs)

Hello. I use InstantCommons that allows wiki to use images from http://commons.wikimedia.org I indicate some images that should be displayed on the page. It works great. But I noticed that this images are uploaded to my server. It is also good, but they are uploaded with all sizes, which is not very well for me, because I have limited size of disc space where I host How can I limit it? How can use only smallest size of the images from commons.wikimadia.org? Thx for help

Krinkle (talkcontribs)

You can set cache-time to 0, then thumbnail will not be stored on your server but links from Commons directly.

Check $wgUseInstantCommons for the settings behind this. Then remove wgUseInstantCommons from your LocalSettings file and instead add the entry for wgForeignFileRepos (values for this can be copied directly from Manual:$wgUseInstantCommons). Then set 'apiThumbCacheExpiry' to 0.

Example:

$wgForeignFileRepos[] = array(
   'class'                   => 'ForeignAPIRepo',
   'name'                    => 'wikimediacommons',
   'apibase'                 => 'http://commons.wikimedia.org/w/api.php',
   'hashLevels'              => 2,
   'fetchDescription'        => true,
   'descriptionCacheExpiry'  => 43200,
   'apiThumbCacheExpiry'     => 0,
);
Fokebox (talkcontribs)

Thx so much! It works! You have saved my disk space at my server )

Stefahn (talkcontribs)

Hello Krinkle,

I have the same problem as Fokebox.
It seems my database is getting bigger with every InstantCommons pic I include on my wiki. Are the pics saved in the database? I couldn't find any of the pics in my images folder...

Does your suggestion (apiThumbCacheExpiry => 0) bring along any drawbacks?

Thanks, Stefan

Bawolff (talkcontribs)

pics are not saved in the db. A very limited amount of information is saved each time you use a picture (Basically, page x is using File with name Y. This is so we can do special:whatlinkshere type pages).

The file description is probably cached, and depending on your configuration, it may end up being cached in the database (Specifically the objectcache table) however i wouldn't expect that to take up too much space. [using the db for caching is really slow, things like memcached offer much better performance]

>Does your suggestion (apiThumbCacheExpiry => 0) bring along any drawbacks?

Higher load on commons ;) [Don't worry commons can handle it. That said if you're a major wiki with tens of thousands of hits a day (or more), probably would be polite to not disable the local thumb caching].

Stefahn (talkcontribs)

Hi Bawolff,

Thanks a lot for your detailed reply!

It's true. Within the last days I monitored the size of my objectcache table - it's growing every day (by ~2 MB) - even when I use 'apiThumbCacheExpiry' => 0. But I guess that's just the usual way a cache works. Or it has to do with Instant pics that I added when apiThumbCacheExpiry had its default value...?

In the documentation of objectcache table it says its content can be deleted. Can I delete them via phpMyAdmin?

Bawolff (talkcontribs)

yes, just be careful not to delete anything from another table

Stefahn (talkcontribs)

 

Reply to "How to use only small images from commons.wikimedia.org?"