小编Lev*_*lun的帖子

添加注释到Openseadragon

var viewer = OpenSeadragon({
    id: "openseadragon1",
    prefixUrl: "images/openseadragon/",
    showNavigator:  true,
    navigatorPosition:   "BOTTOM_RIGHT",
    tileSources: '/fcgi-bin/iipsrv.fcgi?Deepzoom=<?=$plink?>.jp2.dzi',
    crossOriginPolicy: 'Anonymous',
    zoomInButton:   "zoom-in",
    zoomOutButton:  "zoom-out",
    homeButton:     "home",
    fullPageButton: "full-page"
});

anno.makeAnnotatable(viewer);

$.ajax({
    url: "handlers/H_AnnotationHandler.php",
    data: "case_id=<?=$case_id?>&plink=<?=$plink?>&mode=get",
    type: "post",
    dataType: "json",
    success: function(response) {
        if (!response.error) {
            for (var i=0; i<response.annots.length; i++) {
                console.log(response.annots[i].comment);
                anno.addAnnotation({
                    text: response.annots[i].comment,
                    shapes: [{
                        type: 'rect',
                        geometry: {
                            x: response.annots[i].rect_x,
                            y: response.annots[i].rect_y,
                            width: response.annots[i].rect_w,
                            height: response.annots[i].rect_h
                        }
                    }]
                });
            }
        } else {
            console.log(response.error);
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

我可以直接添加注释:http://annotorious.github.io/demos/openseadragon-preview.html …

javascript php jquery openseadragon

16
推荐指数
1
解决办法
2394
查看次数

将Str(hex int)转换为Dec Int

我有一个十六进制的字符串值.我想将其转换为整数.

function HexStrToInt(const str: string): Integer;
begin
  Result := ??;
end;
Run Code Online (Sandbox Code Playgroud)

使得HexStrToInt('22'),例如,返回34.

delphi

4
推荐指数
1
解决办法
9237
查看次数

如何在URL参数中转义斜线

$.ajax({
        url: "/api/v1/cases/annotations/" + case_id + "/" + encodeURIComponent(current_plink),
Run Code Online (Sandbox Code Playgroud)

我正在使用encodeURIComponent来转义斜线。但这对我不起作用。此代码将“斜杠”转换为“%2F”,但是apache无法识别它。

我的PHP部分是这样的:

$app->get('/cases/annotations/:case_id/:prep_name', 'authenticatePathologist', function($case_id, $prep_name) use ($app) {
Run Code Online (Sandbox Code Playgroud)

如果我尝试发送包含斜杠的参数,则返回找不到页面。 在此处输入图片说明

但是,如果我尝试发送不包含斜杠的参数,它将返回确定。 在此处输入图片说明

javascript php

2
推荐指数
1
解决办法
6017
查看次数

如何使用 union 在两个表中进行搜索?

我正在尝试使用如下联合查询在两个表中搜索:

public function searchInAll($keyword) {
    $sql = "(SELECT * FROM user_information 
             WHERE title LIKE ? OR name LIKE ? OR surname LIKE ?)
            UNION
            (SELECT * FROM groups WHERE name LIKE ?)";
    $query = $this->db->prepare($sql);
    $result = $query->execute(array("%$keyword%", "%$keyword%", "%$keyword%", "%$keyword%"));
    if($query->rowCount()) {
        $results = $query->fetchAll();
        return $results;
    }
    return false;
}
Run Code Online (Sandbox Code Playgroud)

它总是返回 false。例如,我尝试使用一张桌子

SELECT * FROM groups WHERE name LIKE ?
Run Code Online (Sandbox Code Playgroud)

或者

SELECT * FROM user_information WHERE title LIKE ? OR name LIKE ? OR surname LIKE ?
Run Code Online (Sandbox Code Playgroud)

这些可以工作,但是对于两个表来说,它不起作用。 …

php mysql pdo

1
推荐指数
1
解决办法
1217
查看次数

TypeError:$(...)。addEventListener不是一个函数

setTimeout(function() {
        $.ajax({
        url : "handlers/H_AnnotationHandler.php",
        data : "case_id=<?=$case_id?>&plink=<?=$plink?>&mode=get",
        type : "post",
        dataType : "json",
        success : function (response) {
            if (!response.error) {
                annotation_length = response.annots.length;
                for (var i = 0; i < response.annots.length; i++) {
                    var elt  = document.createElement("div");
                    elt.id = "runtime-overlay" + i;
                    elt.className = "highlight";
                    viewer.addOverlay({
                        element: elt,
                        location : viewer.viewport.imageToViewportRectangle(parseInt(response.annots[i].rect_x), parseInt(response.annots[i].rect_y), parseInt(response.annots[i].rect_w), parseInt(response.annots[i].rect_h))
                    });
                    $("#runtime-overlay"+i).attr("onclick", "$.clickOverlay('"+i+"')");
                }
            }               
        }
    });
    }, 3000);

    $.clickOverlay = function(whichOverlay) {
            var flag = 0;
            $("#runtime-overlay"+whichOverlay).addEventListener("mousedown", function(){
                flag = 0;
            }, …
Run Code Online (Sandbox Code Playgroud)

javascript

1
推荐指数
2
解决办法
2万
查看次数

标签 统计

javascript ×3

php ×3

delphi ×1

jquery ×1

mysql ×1

openseadragon ×1

pdo ×1