152 lines
6.7 KiB
PHP
152 lines
6.7 KiB
PHP
<?php
|
|
require_once __DIR__ . '/includes/pexels.php';
|
|
|
|
$destination_query = 'Auli India';
|
|
$destination_image = [
|
|
'local_url' => 'https://via.placeholder.com/1200x800.png?text=Auli,+India', // Fallback
|
|
'alt' => 'A beautiful landscape of Auli, India',
|
|
'photographer' => 'N/A',
|
|
'photographer_url' => '#',
|
|
];
|
|
|
|
// Path for the cached JSON data
|
|
$cache_file = __DIR__ . '/assets/cache/pexels_auli.json';
|
|
$cache_ttl = 86400; // Cache for 24 hours
|
|
|
|
$image_data = null;
|
|
|
|
if (file_exists($cache_file) && (time() - filemtime($cache_file)) < $cache_ttl) {
|
|
$image_data = json_decode(file_get_contents($cache_file), true);
|
|
} else {
|
|
$url = 'https://api.pexels.com/v1/search?query=' . urlencode($destination_query) . '&orientation=landscape&per_page=1&page=1';
|
|
$api_data = pexels_get($url);
|
|
|
|
if ($api_data && !empty($api_data['photos'])) {
|
|
$photo = $api_data['photos'][0];
|
|
$src = $photo['src']['large2x'] ?? $photo['src']['large'] ?? $photo['src']['original'];
|
|
$filename = 'pexels-' . $photo['id'] . '.jpg';
|
|
$targetDir = __DIR__ . '/assets/images/destinations/';
|
|
$targetPath = $targetDir . $filename;
|
|
$localUrl = 'assets/images/destinations/' . $filename;
|
|
|
|
if (!file_exists($targetPath)) {
|
|
download_to($src, $targetPath);
|
|
}
|
|
|
|
if (file_exists($targetPath)) {
|
|
$image_data = [
|
|
'local_url' => $localUrl,
|
|
'alt' => $photo['alt'] ?? 'Image of ' . $destination_query,
|
|
'photographer' => $photo['photographer'] ?? 'Unknown',
|
|
'photographer_url' => $photo['photographer_url'] ?? '#',
|
|
];
|
|
|
|
// Cache the data
|
|
if (!is_dir(dirname($cache_file))) mkdir(dirname($cache_file), 0775, true);
|
|
file_put_contents($cache_file, json_encode($image_data));
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($image_data) {
|
|
$destination_image = $image_data;
|
|
}
|
|
|
|
require_once __DIR__ . '/includes/header.php';
|
|
?>
|
|
|
|
<!-- Hero Section -->
|
|
<header id="home" class="hero d-flex align-items-center text-center">
|
|
<div class="container">
|
|
<h1 class="display-4">Plan. Share. Explore.</h1>
|
|
<p class="lead my-4">Your next adventure starts here. Discover, plan, and share your travels with a community of wanderers.</p>
|
|
<a href="#about" class="btn btn-primary btn-lg">Explore Trips</a>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- About Section -->
|
|
<section id="about" class="section">
|
|
<div class="container">
|
|
<div class="row align-items-center">
|
|
<div class="col-lg-6">
|
|
<img src="https://picsum.photos/800/600" alt="A group of friends laughing and planning a trip together." class="img-fluid rounded-3">
|
|
</div>
|
|
<div class="col-lg-6">
|
|
<h2>About TripEase</h2>
|
|
<p>TripEase is more than just a travel app; it's a community-driven platform designed to inspire and empower travelers. From finding your next destination to planning every detail and sharing your experiences, we provide the tools you need to make every trip unforgettable.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Portfolio Section -->
|
|
<section id="portfolio" class="section bg-light">
|
|
<div class="container text-center">
|
|
<h2>Destination of the Month</h2>
|
|
<p class="lead mb-5">Discover Auli, India - a Himalayan ski resort and hill station.</p>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="card">
|
|
<img src="<?php echo htmlspecialchars($destination_image['local_url']); ?>" alt="<?php echo htmlspecialchars($destination_image['alt']); ?>" class="card-img-top">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Auli, India</h5>
|
|
<p class="card-text">With its pristine slopes and stunning mountain views, Auli is a paradise for skiers and nature lovers alike. Photo by <a href="<?php echo htmlspecialchars($destination_image['photographer_url']); ?>"><?php echo htmlspecialchars($destination_image['photographer']); ?></a> on Pexels.</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Testimonials Section -->
|
|
<section id="testimonials" class="section">
|
|
<div class="container">
|
|
<h2 class="text-center mb-5">What Our Travelers Say</h2>
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<div class="card p-4 text-center">
|
|
<p>"TripEase made planning our group trip a breeze. The collaborative features are a game-changer!"</p>
|
|
<footer class="blockquote-footer mt-3">Jane Doe</footer>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="card p-4 text-center">
|
|
<p>"I love the travel style quiz! The recommendations were spot on and introduced me to places I wouldn't have found otherwise."</p>
|
|
<footer class="blockquote-footer mt-3">John Smith</footer>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="card p-4 text-center">
|
|
<p>"The community is so inspiring. I've discovered so many hidden gems through other travelers' stories."</p>
|
|
<footer class="blockquote-footer mt-3">Emily White</footer>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Contact Section -->
|
|
<section id="contact" class="section bg-light">
|
|
<div class="container">
|
|
<h2 class="text-center mb-5">Get in Touch</h2>
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-6">
|
|
<form class="contact-form">
|
|
<div class="mb-3">
|
|
<input type="text" class="form-control" id="name" placeholder="Your Name">
|
|
</div>
|
|
<div class="mb-3">
|
|
<input type="email" class="form-control" id="email" placeholder="Your Email">
|
|
</div>
|
|
<div class="mb-3">
|
|
<textarea class="form-control" id="message" rows="5" placeholder="Your Message"></textarea>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary w-100">Send Message</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|