From 56309597dddb1f4800265ca1eace011a30d47f23 Mon Sep 17 00:00:00 2001 From: alpeb Date: Fri, 13 Feb 2004 01:25:30 +0000 Subject: [PATCH] priority between gif and png as set in config is now working --- phpgwapi/inc/class.common.inc.php | 35 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index c628cc8d4f..851b5b65ee 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -933,18 +933,29 @@ $d->close(); } } + + if (!$GLOBALS['phpgw_info']['server']['image_type']) + { + // priority: GIF->JPG->PNG + $img_type=array('.gif','.jpg','.png'); + } + else + { + // priority: : PNG->JPG->GIF + $img_type=array('.png','.jpg','.gif'); + } - if(isset($this->found_files[$appname][$image.'.png'])) + if(isset($this->found_files[$appname][$image.$img_type[0]])) { - $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image.'.png'].'/'.$image.'.png'; + $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image.$img_type[0]].'/'.$image.$img_type[0]; } - elseif(isset($this->found_files[$appname][$image.'.jpg'])) + elseif(isset($this->found_files[$appname][$image.$img_type[1]])) { - $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image.'.jpg'].'/'.$image.'.jpg'; + $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image.$img_type[1]].'/'.$image.$img_type[1]; } - elseif(isset($this->found_files[$appname][$image.'.gif'])) + elseif(isset($this->found_files[$appname][$image.$img_type[2]])) { - $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image.'.gif'].'/'.$image.'.gif'; + $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image.$img_type[2]].'/'.$image.$img_type[2]; } elseif(isset($this->found_files[$appname][$image])) { @@ -958,17 +969,17 @@ $this->find_image('phpgwapi',''); } - if(isset($this->found_files['phpgwapi'][$image.'.png'])) + if(isset($this->found_files['phpgwapi'][$image.$img_type[0]])) { - $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files['phpgwapi'][$image.'.png'].'/'.$image.'.png'; + $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files['phpgwapi'][$image.$img_type[0]].'/'.$image.$img_type[0]; } - elseif(isset($this->found_files['phpgwapi'][$image.'.jpg'])) + elseif(isset($this->found_files['phpgwapi'][$image.$img_type[1]])) { - $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files['phpgwapi'][$image.'.jpg'].'/'.$image.'.jpg'; + $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files['phpgwapi'][$image.$img_type[1]].'/'.$image.$img_type[1]; } - elseif(isset($this->found_files['phpgwapi'][$image.'.gif'])) + elseif(isset($this->found_files['phpgwapi'][$image.$img_type[2]])) { - $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files['phpgwapi'][$image.'.gif'].'/'.$image.'.gif'; + $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files['phpgwapi'][$image.$img_type[2]].'/'.$image.$img_type[2]; } elseif(isset($this->found_files['phpgwapi'][$image])) {