Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002513Feature RequestsMediapublic2008-11-24 05:212009-07-29 14:02
Reporterromjerome 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Summary0002513: Using section/region on media_ref as thumbnail on reports
DescriptionRegion (rectangle corners) is a great feature on object.media_ref. I use it for individuals on group (photo) and on source editor : split a part of the certificate (ex: witness, parents infos).
http://www.gramps-project.org/wiki/index.php?title=Gramps_3.0_Wiki_Manual_-_Entering_and_Editing_Data:_Detailed#Editing_Media_Object_References [^]

But this is only used on Views, display (Pedigree, editor, etc ...) and ignored on reports. The request will be to use existing thumbnail (subsection) on report instead of the full image (media object).

Also, we can only make a test for looking if object.media_ref_list() exists on gen/lib/MediaBase.py
Steps To Reproduce1. to set a region on media_ref editor (ex: add a media object on Person into the Gallery tab)
http://www.gramps-project.org/wiki/index.php?title=Image:Mediaobj_ref.png [^]
2. to use a report using thumbnails (Detailed reports, individual reports or GraphViz rel_graph)
3. to allow "photo" on report
4. to look at result : report ignores media reference.
Additional InformationOn Editor/_EditMediaRef.py \ def draw_preview, there is this code :

self.mtype = self.source.get_mime_type()
fullpath = media_path_full(self.db, self.source.get_path())

self.subpix = ThumbNails.get_thumbnail_image(fullpath, self.mtype, self.rectangle)
self.subpixmap.set_from_pixbuf(self.subpix)


//////////////////////

Maybe on ThumbNails.py \ def get_thumbnail_image \ def get_thumbnail_path
using Media Object reference instead of Media object, something like :

            if rectangle is not None:
                upper_x = min(rectangle[0], rectangle[2])/100.
                lower_x = max(rectangle[0], rectangle[2])/100.
                upper_y = min(rectangle[1], rectangle[3])/100.
                lower_y = max(rectangle[1], rectangle[3])/100.
                sub_x = int(upper_x * width)
                sub_y = int(upper_y * height)
                sub_width = int((lower_x - upper_x) * width)
                sub_height = int((lower_y - upper_y) * height)
                if sub_width > 0 and sub_height > 0:
                    pixbuf = pixbuf.subpixbuf(sub_x, sub_y, sub_width, sub_height)
                    width = sub_width
                    height = sub_height

and or to retrieve existing "sub-thumbnail" !
TagsNo tags attached.
Attached Files

- Relationships
related to 0001259resolvedbmcage Gramps 3.0.X use thumbnails of subsection instead of the whole image in person specific views 
related to 0001255closed Gramps 2.2.X use thumbnails of subsection instead of the whole image in person specific views 
parent of 0002698resolveddsblank Gramps 3.2.x NarrativeWeb: image regions are ignored in all places except Gallery 
has duplicate 0002776resolvedromjerome Gramps 3.1.X Thumbnail images in report output do not take referenced area into account 
related to 0002472feedback Feature Requests Add all images to a detailed ancestor report. 

-  Notes
(0008401)
stephanecharette (manager)
2009-02-08 13:55

I've made a sibling feature request specific to NarrativeWeb. Feature 0002698.
(0009867)
robhealey1 (developer)
2009-06-29 18:22

Dear Jerome:

I would be very interested in this idea. I think it is a good idea too. I am not sure how to do it right now though.
(0009890)
romjerome (developer)
2009-06-30 05:04

Does it mean you are thinking I should be able to that ?
I just point out a possible missing function/modules...

Currently, Gramps seems to use thumbnails on report, and "sub-section" (if section set) thumbnails on Views. Why not using sub-section thumbnails as main code for generating/calling thumbnails ?

I thought to modify ThumbNails.py could do the job, but I do not know where thumbnails are stored or called and what is the starting point for coding !

I have try to call images for an other [Feature Request] : 0002472
I used the most quickly way, was not properly coded. Like you, to have one thumbnails function, class or module for displaying the same thing on screen and reports is something I would love to see on the next releases but unfortunatly as I do not fully understand, if this works, this will be more black magic than programming wise !
(0009891)
romjerome (developer)
2009-06-30 05:14

Looking at some existing patchs for GraphViz based reports 0002776 :

if mediaMimeType[0:5] == "image":
                         imagePath = ThumbNails.get_thumbnail_path(
                                         Utils.media_path_full(self.db,
- media.get_path())
- )
+ media.get_path()),
+ rectangle=mediaList[0].get_rectangle())

maybe to modify all reports, should be possible too !
(0010219)
romjerome (developer)
2009-07-29 14:02

Detailed reports use :

ReportUtils.insert_image(database, doc, photo, w_cm=4.0, h_cm=4.0) :

    """
    Insert pictures of a person into the document.
    """

    object_handle = photo.get_reference_handle()
    media_object = database.get_object_from_handle(object_handle)
    mime_type = media_object.get_mime_type()
    if mime_type and mime_type.startswith("image"):
        filename = media_path_full(database, media_object.get_path())
        if os.path.exists(filename):
            doc.add_media_object(filename, "right", w_cm, h_cm)
        else:
            WarningDialog(_("Could not add photo to page"),
                          "%s: %s" % (filename, _('File does not exist')))

- Issue History
Date Modified Username Field Change
2008-11-24 05:21 romjerome New Issue
2009-01-17 05:57 romjerome Steps to Reproduce Updated
2009-02-08 13:55 stephanecharette Note Added: 0008401
2009-03-07 08:16 stephanecharette Relationship added child of 0002776
2009-03-07 08:16 stephanecharette Relationship deleted child of 0002776
2009-03-07 08:16 stephanecharette Relationship added has duplicate 0002776
2009-03-07 08:18 stephanecharette Relationship added parent of 0002698
2009-03-28 12:13 romjerome Relationship added related to 0002472
2009-06-27 03:13 romjerome Relationship added related to 0001259
2009-06-29 18:19 robhealey1 Issue Monitored: robhealey1
2009-06-29 18:22 robhealey1 Note Added: 0009867
2009-06-30 05:04 romjerome Note Added: 0009890
2009-06-30 05:14 romjerome Note Added: 0009891
2009-07-04 05:43 romjerome Relationship added related to 0001255
2009-07-29 14:02 romjerome Note Added: 0010219


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker