<?php

class Images extends Model {

  function Images() {
    parent::Model();
  }
  
  function getBillboards($s = ""){
    $url = "pictures/firms_images";
    
    $filearray = array();
    
    $d = opendir($url);
    
    while (($file = readdir($d)) !== false) {
      $filename = explode(".", $file);
      $ext = $filename[count($filename)-1];
      if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'gif' || $ext == 'png')
      {
        if ($s == "" || strpos($file, strtolower($s)) !== false)
          $filearray[] = $file;
      }        
    }
    
    closedir($d);
    
    return $filearray;
  }
  
  function getLogos($s = ""){
    $url = "pictures/firms_logos";
    
    $filearray = array();
    
    $d = opendir($url);
    
    while (($file = readdir($d)) !== false) {
      $filename = explode(".", $file);
      $ext = $filename[count($filename)-1];
      if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'gif' || $ext == 'png')
      {
        if ($s == "" || strpos($file, strtolower($s)) !== false)
          $filearray[] = $file;
      }        
    }
    
    closedir($d);
    
    return $filearray;
  }

}

?>