Beispiel #1
0
        foreach ($photos as $e_k => $element) {
            $imagen = array();
            $ruta = false;
            if (strlen($element->getAttribute('data-resized')) > 0) {
                $ruta = trim($element->getAttribute('data-resized'));
            } else {
                if (strlen($element->getAttribute('href')) > 0) {
                    $ruta = trim($element->getAttribute('href'));
                }
            }
            if ($ruta) {
                $arr = explode(".", $ruta);
                $img_ext = $arr[count($arr) - 1];
                $new_name = md5($ruta);
                $new_file_name = $template_dir . "/images/apartamentos/" . $new_name . "." . $img_ext;
                if (!file_exists($new_file_name)) {
                    file_put_contents($new_file_name, file_get_contents($ruta));
                }
                $new_ruta = $template_url . "/images/apartamentos/" . $new_name . "." . $img_ext;
                $imagen['ruta'] = $new_ruta;
            }
            $imagen['tipo'] = 'imagen';
            $imagen['extension'] = 'jpg';
            insertHotelImage($imagen, $hotel->id);
        }
    }
    $result['msg'] = 'ok';
    $result['data'] = 'Se guardaron los datos correctamente';
}
//print_r($result);
echo json_encode($result);
Beispiel #2
0
                                                     }
                                                     // create a new true color image
                                                     $vDstImg = @imagecreatetruecolor($iWidth, $iHeight);
                                                     // copy and resize part of an image with resampling
                                                     imagecopyresampled($vDstImg, $vImg, 0, 0, 0, 0, $iWidth, $iHeight, $iWidth, $iHeight);
                                                     // define a result image filename
                                                     $sResultFileName = $template_dir . '/images/hotel/' . $FileName . $sExt;
                                                     // output image to file
                                                     imagejpeg($vDstImg, $sResultFileName, $iJpgQuality);
                                                     @unlink($sTempFileName);
                                                     if (isset($_REQUEST['idHotel'])) {
                                                         $hotel_id = $_REQUEST['idHotel'];
                                                         $name = $FileName;
                                                         $ext = $sExt;
                                                         $data_adjunto = array('nombre' => $name, 'ruta' => $template_url . '/images/hotel/' . $FileName . $sExt, 'extension' => $ext, 'tipo' => 'imagen');
                                                         $imagenId = insertHotelImage($data_adjunto, $hotel_id);
                                                         $result['msg'] = $imagenId;
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
    }
}
$descripcion = $html('#summary');
$descripcion_larga = trim($descripcion[0]->getInnerText());
$nombre = $html('#hp_hotel_name');
$nombre = trim($nombre[0]->getInnerText());
$rating = $html('#wrap-hotelpage-top h1 span.use_sprites');
if (isset($rating[0]) && strlen($rating[0]->getAttribute('title')) > 0) {
    $rating = filter_var($rating[0]->getAttribute('title'), FILTER_SANITIZE_NUMBER_INT);
} else {
    $rating = 0;
}
$hotel = array('descripcionLarga' => $descripcion_larga, 'url' => $hotel_url, 'estado' => 'activo', 'visitas' => 0, 'nombre' => $nombre, 'calidad' => (int) $rating);
$hotel_id = insertHotel($hotel);
foreach ($imagenes as $imagen) {
    insertHotelImage($imagen, $hotel_id);
}
//Servicios!
$servicios = $html('.nha_single_unit_facilities .description');
$servicios_array = array();
foreach ($servicios as $servicio) {
    $servicio_t = $servicio('h3');
    $servicio_t = $servicio_t[0]->getPlainText();
    $servicio_p = $servicio('p');
    $servicio_p = $servicio_p[0]->getPlainText();
    $servicios_text = split(',', trim($servicio_p));
    foreach ($servicios_text as $servicio_text) {
        inserHotelServicio(array('categoria' => trim($servicio_t), 'servicio' => trim($servicio_text)), $hotel_id);
    }
}
//Mapa!