From: short <> Date: Thu, 16 Aug 2001 12:30:54 +0000 (+0000) Subject: month_full()->month_a() to unify month elements naming X-Git-Url: http://git.jankratochvil.net/?p=www.energie.vellum.cz.git;a=commitdiff_plain;h=a032f9c9a41115e3c6adadc84fa0160c6062092b month_full()->month_a() to unify month elements naming img_size($one_argument_file_name) autodetects its image size --- diff --git a/common.php b/common.php index 3640ecf..ec896f4 100644 --- a/common.php +++ b/common.php @@ -109,17 +109,26 @@ function db_item($query) return($row[0]); } -function month_full($year,$month,$month_last=0) +function month_a($year,$month,$month_last=0) { global $tb_obsah; if (!$month_last) $month_last=db_item("select month_last from $tb_obsah where year='$year' and month='$month'"); - return(sprintf("%02d".($month==$month_last ? "" : "-%02d"),$month,$month_last)); + $month_full=sprintf("%02d".($month==$month_last ? "" : "-%02d"),$month,$month_last); + + $r=array("year"=>$year,"month"=>$month,"month_last"=>$month_last,"month_full"=>$month_full, + "name"=>"$year/${month_full}", + "img" =>"img/eap-$year-${month_full}.jpg", + "icon"=>"img/eap-$year-${month_full}s.jpg", + ); + return($r); } -function img_size($width,$height) +function img_size($width,$height=0) { + if (!$height) + list($width,$height)=getimagesize($width); return("style=\"border:0;width:${width}px;height:${height}px\" width=\"$width\" height=\"$height\""); }