X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fconcord-images.git;a=blobdiff_plain;f=concord-images.el;h=e51775db7387e51897175f87c6c101758fec9dc7;hp=3290595ecaac2354dcfd22b60c063bffbdf84970;hb=661df4fddf66affa6dbfebb2c0450fd20db4e9c5;hpb=64bf28e26648cecf3026b5c678ecf88b79a9578d diff --git a/concord-images.el b/concord-images.el index 3290595..e51775d 100644 --- a/concord-images.el +++ b/concord-images.el @@ -3,13 +3,13 @@ (defun concord-images-encode-url-as-id (url) (let (ret) (cond - ((string-match "^http://hng\\.chise\\.org/images/iiif/" url) + ((string-match "^http://\\(hng\\|image\\)\\.\\(chise\\.org\\|kanji\\.zinbun\\.kyoto-u\\.ac\\.jp\\)/images/iiif/" url) (setq ret (substring url (match-end 0))) (if (string-match "\\.[a-zA-Z0-9]+$" ret) (substring ret 0 (match-beginning 0)) ret) ) - ((string-match "^http://hng\\.chise\\.org/images/" url) + ((string-match "^http://\\(hng\\|image\\)\\.\\(chise\\.org\\|kanji\\.zinbun\\.kyoto-u\\.ac\\.jp\\)/images/" url) (setq ret (substring url (match-end 0))) (if (string-match "\\.[a-zA-Z0-9]+$" ret) (substring ret 0 (match-beginning 0)) @@ -38,12 +38,12 @@ (goto-char (point-min)) (when (re-search-forward "^[ \t]*\"width\"[ \t]*:[ \t]*\\([0-9]+\\)" nil t) - (concord-object-put img-cobj 'width (string-to-int - (match-string 1)))) + (concord-object-put img-cobj 'image-width + (string-to-int (match-string 1)))) (when (re-search-forward "^[ \t]*\"height\"[ \t]*:[ \t]*\\([0-9]+\\)" nil t) - (concord-object-put img-cobj 'height (string-to-int - (match-string 1)))) + (concord-object-put img-cobj 'image-height + (string-to-int (match-string 1)))) )) (when iip (concord-object-put img-cobj '=location@iip iip)) @@ -77,17 +77,18 @@ (format "%s#xywh=%d,%d,%d,%d" (concord-object-get base-cobj '=location) x y width height)) - (concord-object-put seg-cobj 'offset-x x) - (concord-object-put seg-cobj 'offset-y y) - (concord-object-put seg-cobj 'width width) - (concord-object-put seg-cobj 'height height) + (concord-object-put seg-cobj 'image-offset-x x) + (concord-object-put seg-cobj 'image-offset-y y) + (concord-object-put seg-cobj 'image-width width) + (concord-object-put seg-cobj 'image-height height) (setq seg-iiif-url (format "%s/%d,%d,%d,%d/full/0/default.jpg" base-iiif-url x y width height)) (concord-object-put seg-cobj '=location@iiif seg-iiif-url) (when (setq base-iip-url (concord-object-get base-cobj '=location@iip)) - (setq base-width (concord-object-get base-cobj 'width) + (setq base-width (concord-object-get base-cobj 'image-width) base-width-f (float base-width) - base-height-f (float (concord-object-get base-cobj 'height))) + base-height-f (float + (concord-object-get base-cobj 'image-height))) (setq rel-x (/ x base-width-f) rel-y (/ y base-height-f) rel-w (/ width base-width-f)