Пример #1
0
 function getMap($map_id)
 {
     // db 연결
     $db = new ImgDB();
     // db에서 map_url 가져옴 (user_id, map_url, full_map)
     $map_result = $db->getMap($map_id);
     // db에서 사진들 가져옴
     $images = $db->getImages($map_id);
     $map = "{";
     $map .= "\"map_url\":\"" . $map_result['map_url'] . "\",\"results\":[";
     // 이미지 관련 변수들 JSON 형태로 출력
     foreach ($images as $img) {
         $map .= "\"img_" . $img['img_id'] . "\":[";
         $map .= "\"loc_x\":\"" . $img['loc_x'] . "\", \"loc_y\":\"" . $img['loc_y'] . "\"";
         $map .= ", \"img_url\":\"" . $img['img_url'] . "\"";
         $map .= ", \"description\":\"" . $img['description'] . "\"";
         $map .= ", \"liker\":\"" . $img['liker'] . "\"";
         $map .= "]";
         if (!empty($img)) {
             $map .= ",";
         }
     }
     $map .= "]}";
     return $map;
 }
Пример #2
0
 function getMap($map_id)
 {
     // db 연결
     $db = new ImgDB();
     // db에서 map_url 가져옴 (user_id, map_url, map_capture)
     $map_result = $db->getMap($map_id);
     // db에서 사진들 가져옴
     $img = $db->getImages($map_id);
     $map = array('map_url' => $map_result['map_capture'], 'results' => $img);
     return $map;
 }