Skip to content

Commit

Permalink
Merge pull request Ysurac#455 from Struart88/patch-1
Browse files Browse the repository at this point in the history
Improve airport-data matching
  • Loading branch information
Ysurac authored Jun 12, 2020
2 parents 75f1135 + ab65a47 commit b78c73b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions require/class.Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $
if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name);
if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name);
if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name);
if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name);
if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_icao,$aircraft_name);
if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name);
if (isset($images_array) && $images_array['original'] != '') return $images_array;
}
Expand Down Expand Up @@ -528,13 +528,14 @@ public function fromBing($type,$aircraft_registration,$aircraft_name='') {
* Gets the aircraft image from airport-data
*
* @param String $aircraft_registration the registration of the aircraft
* @param String $aircraft_icao the icao code of the aircraft
* @param String $aircraft_name type of the aircraft
* @return array the aircraft thumbnail, orignal url and copyright
*
*/
public function fromAirportData($type,$aircraft_registration,$aircraft_name='') {
public function fromAirportData($type,$aircraft_registration,$aircraft_icao,$aircraft_name='') {
$Common = new Common();
$url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration;
$url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration.'&m='.$aircraft_icao;
$data = $Common->getData($url);
$result = json_decode($data);
if (isset($result->count) && $result->count > 0) {
Expand Down Expand Up @@ -696,4 +697,4 @@ public function fromCustomSource($type,$registration,$name='') {
//$Image = new Image();
//print_r($Image->fromAirportData('F-GZHM'));

?>
?>

0 comments on commit b78c73b

Please sign in to comment.