";} else { echo "HTTP Header date not available.
";}// Download the image and save it to the destinationfile_put_contents($destination, file_get_contents($url));echo "Image downloaded and saved to: " . $destination . "
";// Set the file modification time to the Unix timestamp from the HTTP headerif ($http_date) { if (touch($destination, $http_date)) { echo "File modification date set to HTTP Last-Modified timestamp: " . date("Y-m-d H:i:s", $http_date) . "
"; } else { echo "Failed to set file modification date.
"; }} else { echo "HTTP Last-Modified timestamp not available to set as file modification date.
";}// Check if EXIF data is availableif (function_exists('exif_read_data')) { $exif_data = exif_read_data($destination); // Extract date from EXIF metadata if (isset($exif_data['DateTime'])) { $exif_date = $exif_data['DateTime']; echo "EXIF Date: " . $exif_date . "
"; } else { echo "EXIF date not available.
"; } // Extract camera make and model information $camera_make = $exif_data['Make'] ?? 'N/A'; $camera_model = $exif_data['Model'] ?? 'N/A'; echo "Camera Make: " . $camera_make . "
"; echo "Camera Model: " . $camera_model . "
"; // Extract GPS data and create Google Maps link if (isset($exif_data['GPSLatitude'], $exif_data['GPSLatitudeRef'], $exif_data['GPSLongitude'], $exif_data['GPSLongitudeRef'])) { // Convert GPS coordinates to decimal format function gps_to_decimal($coord, $hemisphere) { $degrees = count($coord) > 0 ? gps_coord_to_decimal($coord[0]) : 0; $minutes = count($coord) > 1 ? gps_coord_to_decimal($coord[1]) : 0; $seconds = count($coord) > 2 ? gps_coord_to_decimal($coord[2]) : 0; $decimal = $degrees + ($minutes / 60.0) + ($seconds / 3600.0); return ($hemisphere == 'S' || $hemisphere == 'W') ? -$decimal : $decimal; } function gps_coord_to_decimal($coord_part) { $parts = explode('/', $coord_part); if (count($parts) == 2) { return floatval($parts[0]) / floatval($parts[1]); } return 0; } $latitude = gps_to_decimal($exif_data['GPSLatitude'], $exif_data['GPSLatitudeRef']); $longitude = gps_to_decimal($exif_data['GPSLongitude'], $exif_data['GPSLongitudeRef']); echo "Latitude: " . $latitude . "
"; echo "Longitude: " . $longitude . "
"; echo "View on Google Maps
"; } else { echo "GPS data not available.
"; }} else { echo "EXIF reading not supported.
";}?>
";}// Download the image and save it to the destinationfile_put_contents($destination, file_get_contents($url));echo "Image downloaded and saved to: " . $destination . "
";// Set the file modification time to the Unix timestamp from the HTTP headerif ($http_date) { if (touch($destination, $http_date)) { echo "File modification date set to HTTP Last-Modified timestamp: " . date("Y-m-d H:i:s", $http_date) . "
"; } else { echo "Failed to set file modification date.
"; }} else { echo "HTTP Last-Modified timestamp not available to set as file modification date.
";}// Check if EXIF data is availableif (function_exists('exif_read_data')) { $exif_data = exif_read_data($destination); // Extract date from EXIF metadata if (isset($exif_data['DateTime'])) { $exif_date = $exif_data['DateTime']; echo "EXIF Date: " . $exif_date . "
"; } else { echo "EXIF date not available.
"; } // Extract camera make and model information $camera_make = $exif_data['Make'] ?? 'N/A'; $camera_model = $exif_data['Model'] ?? 'N/A'; echo "Camera Make: " . $camera_make . "
"; echo "Camera Model: " . $camera_model . "
"; // Extract GPS data and create Google Maps link if (isset($exif_data['GPSLatitude'], $exif_data['GPSLatitudeRef'], $exif_data['GPSLongitude'], $exif_data['GPSLongitudeRef'])) { // Convert GPS coordinates to decimal format function gps_to_decimal($coord, $hemisphere) { $degrees = count($coord) > 0 ? gps_coord_to_decimal($coord[0]) : 0; $minutes = count($coord) > 1 ? gps_coord_to_decimal($coord[1]) : 0; $seconds = count($coord) > 2 ? gps_coord_to_decimal($coord[2]) : 0; $decimal = $degrees + ($minutes / 60.0) + ($seconds / 3600.0); return ($hemisphere == 'S' || $hemisphere == 'W') ? -$decimal : $decimal; } function gps_coord_to_decimal($coord_part) { $parts = explode('/', $coord_part); if (count($parts) == 2) { return floatval($parts[0]) / floatval($parts[1]); } return 0; } $latitude = gps_to_decimal($exif_data['GPSLatitude'], $exif_data['GPSLatitudeRef']); $longitude = gps_to_decimal($exif_data['GPSLongitude'], $exif_data['GPSLongitudeRef']); echo "Latitude: " . $latitude . "
"; echo "Longitude: " . $longitude . "
"; echo "View on Google Maps
"; } else { echo "GPS data not available.
"; }} else { echo "EXIF reading not supported.
";}?>