getConnection(); $galeria = new Galeria($db); $stmt = $galeria->gallery_images($id); $num = $stmt->rowCount(); if($num>0){ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row); if($imagenes){ $ilist = unserialize($imagenes); foreach($ilist as $i){ array_push($image_ids,$i); } } if($sin_recortar){ $slist = unserialize($sin_recortar); foreach($slist as $i){ array_push($image_ids,$i); } } } } //Get all images from image_ids array foreach($image_ids as $image){ $stmt = $galeria->image($image); $num = $stmt->rowCount(); if($num>0){ while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row); array_push($images,unserialize($imagedata)); } } } $data = array( 'count' => count($images), 'result' => array ( 'images' => $images ) ); send_response( $data ); } function gallery_list(){ $database = new Database(); $db = $database->getConnection(); $galeria = new Galeria($db); $stmt = $galeria->gallery_list(); $num = $stmt->rowCount(); if($num>0){ $galleries_arr=array(); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){ extract($row); $response_item=array( "title" => $post_title, "id" => $ID, "date" => $post_date, "thumbnail" => $thumbnail ); array_push($galleries_arr, $response_item); } } $data = array( 'count' => count($galleries_arr), 'result' => array ( 'galleries' => $galleries_arr ) ); send_response( $data ); } function send_response( $data ){ // set response code - 200 OK header('Content-Type: application/json; charset=utf-8'); http_response_code(200); echo json_encode( $data, JSON_UNESCAPED_UNICODE ); }