! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Thunar 1.8 fails to show thumbnails for webm, txt, html and mardown files
Status:
RESOLVED: FIXED

Comments

Description Phil4000n 2019-07-12 18:56:17 CEST
Following https://bugzilla.xfce.org/show_bug.cgi?id=12528 and https://docs.xfce.org/xfce/thunar/tumbler

On Manjaro XFCE 18.1 RC3, I tried to have txt thumbnails with

[Thumbnailer Entry]
Version=1.0
Encoding=UTF-8
Type=X-Thumbnailer
Name=txt Thumbnailer
MimeType=text/plain;
Exec=/usr/bin/convert -thumbnail %s %i %o

But it fails, as well as for:
* webm
* html (html5 in case it matters)
* markdown(which can be converted to html5 before)


NOTE
pamac says I have Thunar-gtk3 1.8.7-3 installed, but
Thunar in About show "1.8.5git-8c4cd0"


Thanks
Comment 1 Theo Linkspfeifer editbugs 2019-07-12 20:18:41 CEST
Thunar does not fail in this case. It is tumbler that cannot generate a thumbnail for those files, because /usr/bin/convert only accepts image files. You will have to use a different program or write your own one for this purpose.
Comment 2 Phil4000n 2019-07-18 23:13:25 CEST
> tumbler that cannot generate a thumbnail for those files, because /usr/bin/convert only accepts image files.
It's not what I achieved, see below.

>You will have to use a different program or write your own one for this purpose.
Well, KDE Dolphin supports preview of text files


I'm a beginner, but I test some scripting concepts:
For text base files it could be something such as:

iFile=$(<"testSomeTextFile.md")
	iChopped="${iFile:0:1600}"
	unset iFile
	echo "${iChopped}" > "tmp.txt"
	unset iChopped
	convert -size 210x290 -background white -pointsize 5 -border 10x10 -bordercolor "#CCC" caption:@"tmp.txt" "testSomeTextFile.png"

This shows it's possible to create a thumbnail for any text base file, and one could even have option to distinguish file types (md, txt, css, etc) by changing either:
- font colour,
- background color or
- border colour.
- or having an image overlay (such as it's so nicely done currently).


Regarding html, depending on CPU ressources, one could go an extra step and interpreter the html in such a way:
	iFile=$(<"test.htm")
	iChopped="${iFile:0:3200}"
	unset iFile
	echo "${iChopped}" > "test.htm"
	unset iChopped

	wkhtmltoimage "test.htm" --width 260 --height 260 test.png
Comment 3 ToZ editbugs 2019-07-19 13:09:18 CEST
You can use the desktop thumbnailer and create a custom thumbnailer to accomplish this.

First, create the file /usr/share/thumbnailers/text.thumbnailer with the following content:

[Thumbnailer Entry]
Version=1.0
Encoding=UTF-8
Type=X-Thumbnailer
Name=Text Thumbnailer
MimeType=text/plain;text/html;text/css;
Exec=/usr/local/bin/textthumb %s %i %o

*add any other MimeTypes that you would like covered to the MimeType line

Second, create the file /usr/local/bin/textthumb with the following content:

#!/bin/bash
iFile=$(<"$2")
iChopped="${iFile:0:1600}"
unset iFile
echo "${iChopped}" > tmp.txt
unset iChopped
convert -size 210x290 -background white -pointsize 5 -border 10x10 -bordercolor "#CCC" caption:@"tmp.txt" "$3"
rm tmp.txt

*make this file executable.

Restart tumbler and you should get text thumbnails. (Note: depends on tumbler 0.2 or greater).
Comment 4 alexxcons editbugs 2019-07-19 15:07:51 CEST
@ToZ
Thanks for the script !
If you tested it, could you please add it to https://docs.xfce.org/xfce/thunar/tumbler  ?
( I as well can do so, if you prefer )

Afterwards I guess we can close this bug
Comment 5 ToZ editbugs 2019-07-20 00:40:00 CEST
Added to the tumbler wiki entry.
Comment 6 alexxcons editbugs 2019-07-20 11:48:44 CEST
(In reply to ToZ from comment #5)
> Added to the tumbler wiki entry.

Great, thanks !

Bug #15706

Reported by:
Phil4000n
Reported on: 2019-07-12
Last modified on: 2019-07-20

People

Assignee:
Xfce Bug Triage
CC List:
3 users

Version

Attachments

Additional information