allows image pref order

This commit is contained in:
seek3r 2002-01-21 17:51:54 +00:00
parent bcd7dc31eb
commit e7a82bc085

View File

@ -776,6 +776,16 @@
function find_image($appname,$image) function find_image($appname,$image)
{ {
if (!isset($GLOBALS['phpgw_info']['server']['imgtype_preference_order']))
{
$imgpref = Array('gif','jpg','png');
}
else
{
$imgpref = $GLOBALS['phpgw_info']['server']['imgtype_preference_order'];
}
if (!@is_array($this->found_files[$appname])) if (!@is_array($this->found_files[$appname]))
{ {
$imagedir_olddefault = '/'.$appname.'/images'; $imagedir_olddefault = '/'.$appname.'/images';
@ -822,33 +832,33 @@
} }
} }
if(isset($this->found_files[$appname][$image.'.png'])) if(isset($this->found_files[$appname][$image.'.'.$imgpref[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.'.'.$imgpref[0]].'/'.$image.'.'.$imgpref[0];
} }
elseif(isset($this->found_files[$appname][$image.'.jpg'])) elseif(isset($this->found_files[$appname][$image.'.'.$imgpref[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.'.'.$imgpref[1]].'/'.$image.'.'.$imgpref[1];
} }
elseif(isset($this->found_files[$appname][$image.'.gif'])) elseif(isset($this->found_files[$appname][$image.'.'.$imgpref[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.'.'.$imgpref[2]].'/'.$image.'.'.$imgpref[2];
} }
elseif(isset($this->found_files[$appname][$image])) elseif(isset($this->found_files[$appname][$image]))
{ {
$imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image].'/'.$image; $imgfile = $GLOBALS['phpgw_info']['server']['webserver_url'].$this->found_files[$appname][$image].'/'.$image;
} }
elseif(isset($this->found_files['phpgwapi'][$image.'.png'])) elseif(isset($this->found_files['phpgwapi'][$image.'.'.$imgpref[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.'.'.$imgpref[0]].'/'.$image.'.'.$imgpref[0];
} }
elseif(isset($this->found_files['phpgwapi'][$image.'.jpg'])) elseif(isset($this->found_files['phpgwapi'][$image.'.'.$imgpref[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.'.'.$imgpref[1]].'/'.$image.'.'.$imgpref[1];
} }
elseif(isset($this->found_files['phpgwapi'][$image.'.gif'])) elseif(isset($this->found_files['phpgwapi'][$image.'.'.$imgpref[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.'.'.$imgpref[2]].'/'.$image.'.'.$imgpref[2];
} }
elseif(isset($this->found_files['phpgwapi'][$image])) elseif(isset($this->found_files['phpgwapi'][$image]))
{ {