[EP-tech] Re: Thumbnails - documentation

John Salter J.Salter at leeds.ac.uk
Tue Oct 30 17:15:14 GMT 2012

One line in the email below isn't quite right:
$c->{plugins}->{'Convert::Thumbnails'}->{call_convert} = sub {
Should be:
$c->{plugins}->{'Convert::Thumbnails'}->{params}->{call_convert} = sub {

I've added the following page to the Wiki:
If I've done anything stupid, or if you've done something fancy with your thumbnails, feel free to edit it!


-----Original Message-----
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of John Salter
Sent: 29 October 2012 14:27
To: 'eprints-tech at ecs.soton.ac.uk'
Subject: [EP-tech] Thumbnails - documentation

I'm adding a new thumbnail size to my archive.
The documentation here: http://wiki.eprints.org/w/API:EPrints/Plugin/Convert/Thumbnails doesn't really explain fully what you need to do. I've got it working, but wondered if I'd done it the *right* way.
Anyone care to comment?
If what I've done is *right*, I'll add it to the wiki!

This is what I did:
1. In ~/archives/[ARCHIVEID]/cfg/cfg.d/plugins.pl, add:
$c->{plugins}->{'Convert::Thumbnails'}->{params}->{sizes} = {(
        small => [66,50],
        homepage => [160, 90], #This is the new one
        medium => [200,150],
        preview => [400,300],
        lightbox => [640,480],
$c->{thumbnail_types} = sub {
        my( $list, $repo, $doc ) = @_;
        push @$list, qw( homepage );

So far so good - this gets the new thumbnail size to be generated, but it's a scaled down version of the original, not a cropped version (e.g. like a 'medium' thumbnail, not like 'small' thumbnail).

The code that decides how to process the thumbnails (sub call_convert) is copied from ~/perl_lib/EPrints/Plugin/Convert/Thumbnails.pm, and added to ~/archives/[ARCHIVEID]/cfg/cfg.d/plugins.pl:
$c->{plugins}->{'Convert::Thumbnails'}->{call_convert} = sub {
	my( $self, $dir, $doc, $src, $geom, $size ) = @_;
	#change _system call for 'homepage' size

Is all/any of that sane/insane?
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/

More information about the Eprints-tech mailing list