Skip to content

Commit

Permalink
fixed image issues for unknown people and removed some unused logging
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Jan 22, 2014
1 parent e0316d7 commit e7659ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
6 changes: 3 additions & 3 deletions webapp/catalogues/options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
<entry xml:id="dic_de" type="xs:string">/db/apps/WeGA-WebApp/catalogues/dictionary_de.xml</entry>
<entry xml:id="dic_en" type="xs:string">/db/apps/WeGA-WebApp/catalogues/dictionary_en.xml</entry>
<!-- <entry xml:id="imagesDir" type="xs:string">/db/images/</entry>-->
<!-- <entry xml:id="unknownMan" type="xs:string">/db/images/persons/unknown/nobody_m.png</entry>-->
<!-- <entry xml:id="unknownWoman" type="xs:string">/db/images/persons/unknown/nobody_f.png</entry>-->
<!-- <entry xml:id="unknownSex" type="xs:string">/db/images/persons/unknown/nobody_n.png</entry>-->
<entry xml:id="unknownMan" type="xs:string">persons/unknown/nobody_m.png</entry> <!-- digilib path -->
<entry xml:id="unknownWoman" type="xs:string">persons/unknown/nobody_f.png</entry> <!-- digilib path -->
<entry xml:id="unknownSex" type="xs:string">persons/unknown/nobody_n.png</entry> <!-- digilib path -->
<entry xml:id="persNamesFile" type="xs:string">/db/apps/WeGA-WebApp/tmp/persNames.xml</entry>
<entry xml:id="lettersNormDatesFile" type="xs:string">/db/apps/WeGA-WebApp/tmp/lettersNormDates.xml</entry>
<entry xml:id="writingsNormDatesFile" type="xs:string">/db/apps/WeGA-WebApp/tmp/writingsNormDates.xml</entry>
Expand Down
16 changes: 3 additions & 13 deletions webapp/modules/img.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ declare function img:getPortraitPath($person as node(), $dimensions as xs:intege
let $unknownWoman := config:get-option('unknownWoman')
let $unknownMan := config:get-option('unknownMan')
let $unknownSex := config:get-option('unknownSex')
let $localPortrait := core:getOrCreateColl('iconography', $docID, true())//tei:figure[@n='portrait'][1]
let $localPortraitURL := core:getOrCreateColl('iconography', $docID, true())//tei:figure[@n='portrait'][1]//tei:graphic[1]/data(@url)
let $cachedPortrait := doc(concat($config:tmp-collection-path, replace($docID, '\d{2}$', 'xx'), '/', $docID, '.xml'))//localFile/string()
let $graphicURL :=
if(exists($localPortrait)) then
if(functx:all-whitespace($localPortrait//tei:graphic[1]/data(@url))) then ()
else string-join((substring-after(config:getCollectionPath($docID), $config:data-collection-path || '/'), $docID, $localPortrait//tei:graphic[1]/data(@url)), '/')
if(not(functx:all-whitespace($localPortraitURL))) then string-join((substring-after(config:getCollectionPath($docID), $config:data-collection-path || '/'), $docID, $localPortraitURL), '/')
else
if(util:binary-doc-available($cachedPortrait)) then $cachedPortrait
else
Expand Down Expand Up @@ -97,7 +95,6 @@ declare function img:retrieveImagesFromWikipedia($pnd as xs:string, $lang as xs:

declare function img:retrievePicture($picURL as xs:anyURI, $localName as xs:string?) as xs:string? {
let $suffix := lower-case(functx:substring-after-last($picURL, '.'))
(: let $log := util:log-system-out($picURL):)
let $localFileName := if(matches($localName, '\S'))
then $localName
else util:hash($picURL, 'md5')
Expand Down Expand Up @@ -221,13 +218,7 @@ declare function img:createDigilibURL($localPicURL as xs:string, $dimensions as
else 1
let $wx := (1 - $ww) div 2
let $digilibParams := concat('&#38;dw=', string($dw), '&#38;dh=', string($dh), '&#38;ww=', string($ww), '&#38;wh=', string($wh), '&#38;wx=', string($wx), '&#38;mo=q2')
return (:if(starts-with($localPicURL, $tmpDir))
then concat(replace($localPicURL, '/db/webapp/', $digilibDir), $digilibParams)
else if(starts-with($localPicURL, $pixDir))
then concat(replace($localPicURL, '/db/webapp/', $digilibDir), $digilibParams)
else if(starts-with($localPicURL, $imagesDir))
then concat(replace($localPicURL, $imagesDir, $digilibDir), $digilibParams)
else ():)
return
img:replace-url-for-digilib($localPicURL, $digilibParams)
};

Expand All @@ -250,7 +241,6 @@ declare function img:createDigilibURL($localPicURL as xs:string, $crop as xs:boo

declare %private function img:replace-url-for-digilib($localPicURL as xs:string, $digilibParams as xs:string) as xs:string {
let $digilibDir := config:get-option('digilibDir')
let $log := util:log-system-out($localPicURL)
let $digilibURL :=
(: case 1: Images are stored in $config:tmp-collection-path :)
if(starts-with($localPicURL, $config:tmp-collection-path)) then concat(replace($localPicURL, $config:app-root || '/', $digilibDir), $digilibParams)
Expand Down

0 comments on commit e7659ca

Please sign in to comment.