Skip to content

Commit

Permalink
replace subtr(glob()) which does not work, with a hack to get the cus…
Browse files Browse the repository at this point in the history
…tom icon file extention
  • Loading branch information
Greg committed May 15, 2014
1 parent 28f9458 commit 9d4cbf4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion get_custom_logo.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,21 @@
require(AT_INCLUDE_PATH . 'lib/mime.inc.php');

$file = AT_CONTENT_DIR .'/logos/custom_logo.';
$ext = substr(glob ($file.'{jpg,png,gif}', GLOB_BRACE)[0], -3, 4);

// The following line fails, returning an error
// substr() expects parameter 1 to be string, array given in /var/www/ATutor/get_custom_logo.php on line 24
//$ext = substr(glob($file.'{jpg,png,gif}', GLOB_BRACE), -3, 4);

// So a hack to figure out the file extention
if(file_exists($file."png")){
$ext = "png";
} else if(file_exists($file."gif")){
$ext = "gif";
} else if(file_exists($file."jpg")){
$ext = "jpg";
}


$file = $file.$ext;

$real = realpath($file);
Expand Down

0 comments on commit 9d4cbf4

Please sign in to comment.