Re: Better PDF/PS/Dia thumbnailers



> A little but the text in the icon would be wayyyy too small to read. The 
> thumbnail could look like a word processor frame with top and left rulers 
> but only showing the first line or two of text and filling the rest of the 
> icon.
> 
> The idea is to guess the contents of the document at a glance.
> 
> Cheers
> 
> Martin
>  

My personal preference is for the thumbnail to show the entire first
page of the document. I have many printed documents lying around, and
the text often has no relation to the source file name - but I can match
the frontpage of a printed document to a good fullpage thumbnail. The
other problem is non-text files. I have a PS/EPS/PDF graphics around,
and for these a whole-document image is best.

Anyway, I've updated the scripts a little. Shane Mueller emailed me just
recently regarding the filename handling code at the start of the
scripts. It was nowhere near as robust as I thought, and he suggested a
fix using more sed commands, but I've come up with something else which
I think will work.

INPUT=$(echo -e "$(echo $1 | sed -e 's/^file:\/\///' -e 's/\\/\\\\/g' -e
's/%/\\x/g')")

It echoes the input filename through sed, which strips of the file://
stuff at the start, changes all instances of '\' to '\\', and the
changes all instances of '%' to '\x'. This is then fed to echo, with the
-e option set, which treats instances of \x[0-9][0-9] as hexadecimal
references. The resulting conversions look like this:

 file name: /really/nasty/with % and & and $.ps
input name: file:///really/nasty/with%20%25%20and%20%26%20and%20%24.ps
 after sed: /really/nasty/with\x20\x25\x20and\x20\x26\x20and\x20\x24.ps
after echo: /really/nasty/with % and & and $.ps

There was also a small fix to ensure that only the file:// at the start
was stripped (ie. not any other instances if the URL is not a file://
one). I've uploaded the changed scripts, and a screenshot of how you're
thumbnails should look to the same place as last time:
  http://www.dsl.uow.edu.au/~harvey/code/thumbnailers.tar.gz
  http://www.dsl.uow.edu.au/~harvey/code/thumbnailers.png

One question I do have with the current system of thumbnailers is -
What's the correct size for thumbnails? Nautilus doesn't scale them back
down if they're inappropriately large, which I think it should. If the
correct thumbnail size is set somewhere in the gconf database, we can
easily get it out using gconftool. The same goes for per-thumbnailer
options like maximum file sizes or CPU times.

Regards.

-- 
Peter Harvey <pharvey uow edu au>

PS. I've tried to subscribe, but there's problems (most likely with my
University's email system), so I don't get a request to confirm.






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]