diff --git a/gramps/gen/plug/docgen/treedoc.py b/gramps/gen/plug/docgen/treedoc.py index 8d6a76a7909..86784514ab4 100644 --- a/gramps/gen/plug/docgen/treedoc.py +++ b/gramps/gen/plug/docgen/treedoc.py @@ -46,6 +46,7 @@ from ...constfunc import win from ...config import config from ...const import GRAMPS_LOCALE as glocale +from ...utils.thumbnails import get_thumbnail_path _ = glocale.translation.gettext @@ -589,12 +590,16 @@ def write_node(self, db, level, node_type, person, marriage_flag, option_list=No self.write(level + 1, "comment = {%s},\n" % escape(attr.get_value())) for mediaref in person.get_media_list(): media = db.get_media_from_handle(mediaref.ref) - path = media_path_full(db, media.get_path()) - if os.path.isfile(path): - if win(): - path = path.replace("\\", "/") - self.write(level + 1, "image = {%s},\n" % path) - break # first image only + if media.get_mime_type().startswith("image"): + path = get_thumbnail_path( + media_path_full(db, media.get_path()), + rectangle=mediaref.get_rectangle(), + ) + if os.path.isfile(path): + if win(): + path = path.replace("\\", "/") + self.write(level + 1, "image = {%s},\n" % path) + break # first image only self.write(level, "}\n") def write_event(self, db, level, event):