Beispiel #1
0
 public function getpix($team)
 {
     $pt = $this->params->get('picture_type');
     if ($this->params->get('show_picture') == 0) {
         return false;
     }
     $appendimage = ' align="middle" ';
     $countrycode = $team->country;
     if ($pt == "country" && strlen($countrycode) == 3) {
         $pic['src'] = Countries::getIso3Flag($countrycode);
         $pic['alt'] = Countries::getCountryName($countrycode);
     } else {
         $defaultlogos = $this->getDefaultLogos();
         $matchpart_pic = !empty($team->{$pt}) && file_exists(JPATH_ROOT . '/' . $team->{$pt}) ? $team->{$pt} : $defaultlogos[$pt];
         if (file_exists(JPATH_ROOT . '/' . $matchpart_pic)) {
             $size = getimagesize(JPATH_ROOT . '/' . $matchpart_pic);
             $pic_width = $size[0];
             $pic_height = $size[1];
             $whichparam = $pic_width > $pic_height ? ' width' : ' height';
             if ($this->params->get('xsize') > 0) {
                 $appendimage .= $whichparam . '="' . $this->params->get('xsize') . '"';
             } elseif ($this->params->get('ysize') > 0) {
                 $appendimage .= $whichparam . '="' . $this->params->get('ysize') . '"';
             }
         }
         $pic['src'] = trim($matchpart_pic) != "" && file_exists(JPATH_ROOT . '/' . trim($matchpart_pic)) ? JUri::root(true) . '/' . $matchpart_pic : JUri::root(true) . '/' . $defaultlogos[$pt];
         $pic['alt'] = $this->jl_utf8_convert($team->name, 'iso-8859-1', 'utf-8');
     }
     $pic['append'] = $appendimage;
     return $pic;
 }
Beispiel #2
0
 /**
  * example: echo Countries::getCountryFlag($country);
  *
  * @param string: an iso3 country code, e.g AUT
  * @param string: additional html attributes for the img tag
  * @return string: html code for the flag image
  */
 public static function getCountryFlag($countrycode, $attributes = '')
 {
     self::includeLanguageFile();
     $src = Countries::getIso3Flag($countrycode);
     if (!$src) {
         return '';
     }
     $html = '<img src="' . $src . '" alt="' . Countries::getCountryName($countrycode) . '" ';
     $html .= 'title="' . Countries::getCountryName($countrycode) . '" ' . $attributes . ' />';
     return $html;
 }