Ignore:
Timestamp:
2022-06-21T15:54:45+12:00 (2 months ago)
Author:
davidb
Message:

Check for any sign of text being bound to the doc, before going ahead with the 'dummy text' hack originally added in for mg

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/ImagePlugin.pm

    r31492 r36271  
    147147        $doc_obj->add_metadata ($section, "thumbicon", "<img src=\"_httpprefix_/collect/[collection]/index/assoc/[assocfilepath]/[srclinkFile]\" alt=\"[srclinkFile]\" width=\"" . $self->{'thumbnailsize'} . "\">");
    148148    }
    149     #we have no text - adds dummy text and NoText metadata
    150     $self->add_dummy_text($doc_obj, $doc_obj->get_top_section());
     149
     150    # A plugin inheriting from this might be able to derive text from the image
     151    # (e.g., through GoogleVisionAPI), and so don't just assume there is no
     152    # text for the image -- check it's text length, and only set the dummy
     153    # text if it is zero
     154    if ($doc_obj->get_total_text_length() == 0) {
     155    #we have no text - adds dummy text and NoText metadata
     156        $self->add_dummy_text($doc_obj, $doc_obj->get_top_section());
     157    }
    151158   
    152159    return 1;
Note: See TracChangeset for help on using the changeset viewer.